delete update-dev0 subroutine
This commit is contained in:
parent
5978da6213
commit
5783a222e0
|
@ -86,7 +86,8 @@
|
|||
#1c92 .System/g DEO2
|
||||
#1c47 .System/b DEO2
|
||||
|
||||
( #10 #08 DIV PRINT-DIGIT )
|
||||
|
||||
( initial conditions )
|
||||
|
||||
#10 .dev0/period STZ
|
||||
#77 .dev0/pattern STZ
|
||||
|
@ -132,7 +133,6 @@ BRK
|
|||
#00 ;update-dev JSR2
|
||||
#01 ;update-dev JSR2
|
||||
#02 ;update-dev JSR2
|
||||
( ;update-dev0 JSR2 )
|
||||
|
||||
&draw-registers
|
||||
;pos-x-dev0 LDA2 pos-y-dev #00
|
||||
|
@ -215,57 +215,6 @@ BRK
|
|||
STHr ( get played ) STHr ( get beat ) SWP ;draw-beat JSR2
|
||||
RTN
|
||||
|
||||
@update-dev0 ( -- )
|
||||
#00 ,&played STR
|
||||
.framecount0 LDZ #01 ADD DUP .framecount0 STZ ( inc frame counter )
|
||||
.dev0/period LDZ LTH ( is it less than period? )
|
||||
,&done JCN
|
||||
|
||||
#00 .framecount0 STZ ( reset frame counter )
|
||||
|
||||
.beat0 LDZ
|
||||
.dev0/beatcount LDZ #04 SFT GTH ( is it greater than beat count ? )
|
||||
,&reset-beat JCN
|
||||
,&check-pattern JMP
|
||||
|
||||
&played $1
|
||||
|
||||
&done
|
||||
RTN
|
||||
|
||||
&reset-beat
|
||||
( reset beat when equal to beat count )
|
||||
#00 .beat0 STZ
|
||||
|
||||
&check-pattern
|
||||
.dev0/pattern LDZ ( load pattern )
|
||||
.beat0 LDZ ( check bit number beat in pattern: ) ( DUP #30 ADD .Console/write DEO )
|
||||
SFT ( shift pattern beat bits to the right )
|
||||
#01 AND ( mask bit DUP #30 ADD .Console/write DEO )
|
||||
,&play-sound JCN ( if pattern bit is 1, play sound )
|
||||
,&inc-beat JMP ( finish if pattern bit is 0 )
|
||||
|
||||
&play-sound
|
||||
.dev0/sample LDZ2 #0fff AND2 ( get rid of highest nibble )
|
||||
.Audio0/length DEO2 ( set sample length )
|
||||
#00 .dev0/sample LDZ #30 AND #03 SFT ( get sample number with offset ) ( #02 MUL ) ( short offset )
|
||||
;samples ADD2 LDA2 ( get sample address )
|
||||
.Audio0/addr DEO2
|
||||
|
||||
.dev0/adsr LDZ2 .Audio0/adsr DEO2
|
||||
.dev0/volume LDZ .Audio0/volume DEO
|
||||
.beat0 LDZ .dev0/melody ADD ( get pitch from melody )
|
||||
LDZ .Audio0/pitch DEO
|
||||
|
||||
#01 ,&played STR
|
||||
|
||||
&inc-beat
|
||||
.dev0/beatcount LDZ #f0 AND .beat0 LDZ ORA .dev0/beatcount STZ
|
||||
( draw beat )
|
||||
( pos-x-dev0 .beat0 LDZ ,&played LDR ;draw-beat JSR2 )
|
||||
.beat0 LDZ #01 ADD #07 AND .beat0 STZ ( increment and save beat )
|
||||
|
||||
RTN
|
||||
|
||||
@draw-beat ( x2 beat played -- )
|
||||
,&played JCN
|
||||
|
|
Loading…
Reference in New Issue