add play/pause
This commit is contained in:
parent
b321104198
commit
c40cf5574d
22
main.usm
22
main.usm
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
|0000
|
|0000
|
||||||
|
|
||||||
@Playback [ &position $2 &pattern-addr $2 &tick $1 &speed $1 ]
|
@Playback [ &position $2 &pattern-addr $2 &tick $1 &speed $1 &playing $1 ]
|
||||||
@Draw [ &row $1 &col $1
|
@Draw [ &row $1 &col $1
|
||||||
&pattern-x $2 &pattern-y $2
|
&pattern-x $2 &pattern-y $2
|
||||||
&pattern-vspacing $2 &pattern-hspacing $2
|
&pattern-vspacing $2 &pattern-hspacing $2
|
||||||
|
@ -73,6 +73,8 @@
|
||||||
#0007 .Draw/playhead-x STZ2
|
#0007 .Draw/playhead-x STZ2
|
||||||
#0004 .Draw/pattern-hspacing STZ2
|
#0004 .Draw/pattern-hspacing STZ2
|
||||||
|
|
||||||
|
#01 .Playback/playing STZ
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@get-selected-addr ( -- addr* ) ( get the address of the current selection in the pattern )
|
@get-selected-addr ( -- addr* ) ( get the address of the current selection in the pattern )
|
||||||
|
@ -124,12 +126,20 @@ RTN
|
||||||
@on-button ( -> )
|
@on-button ( -> )
|
||||||
.Controller/button DEI ( get button )
|
.Controller/button DEI ( get button )
|
||||||
;handle-cursor JSR2
|
;handle-cursor JSR2
|
||||||
.Controller/key DEI
|
.Controller/key DEI DUP
|
||||||
;handle-editing JSR2
|
;handle-editing JSR2
|
||||||
|
( play/pause )
|
||||||
|
#70 NEQ ,&end JCN
|
||||||
|
.Playback/playing LDZ #00 EQU .Playback/playing STZ
|
||||||
|
&end
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@on-frame ( -> )
|
@on-frame ( -> )
|
||||||
;draw JSR2
|
;draw JSR2
|
||||||
|
.Playback/playing LDZ #00 NEQ ,&play JCN ( if we're paused, skip playback )
|
||||||
|
;pause JSR2
|
||||||
|
BRK
|
||||||
|
&play
|
||||||
.Playback/tick LDZ .Playback/speed LDZ NEQ ,&inc JCN ( if the tick != speed, skip to inc )
|
.Playback/tick LDZ .Playback/speed LDZ NEQ ,&inc JCN ( if the tick != speed, skip to inc )
|
||||||
;on-step JSR2 ( otherwise, run the on-step routine )
|
;on-step JSR2 ( otherwise, run the on-step routine )
|
||||||
#00 .Playback/tick STZ ( reset the tick )
|
#00 .Playback/tick STZ ( reset the tick )
|
||||||
|
@ -139,6 +149,11 @@ BRK
|
||||||
&end
|
&end
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@pause ( pause playback )
|
||||||
|
#00 .Playback/tick STZ
|
||||||
|
#ff .Audio1/pitch DEO
|
||||||
|
RTN
|
||||||
|
|
||||||
@draw-nibble ( nibble )
|
@draw-nibble ( nibble )
|
||||||
#00 SWP ;hex-chars ADD2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 ( locate nibble in the hex font )
|
#00 SWP ;hex-chars ADD2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 ( locate nibble in the hex font )
|
||||||
.Edit/selection-y LDZ .Draw/row LDZ NEQ
|
.Edit/selection-y LDZ .Draw/row LDZ NEQ
|
||||||
|
@ -175,8 +190,7 @@ RTN
|
||||||
#3b ;draw-char JSR2
|
#3b ;draw-char JSR2
|
||||||
#00 ;draw-char JSR2
|
#00 ;draw-char JSR2
|
||||||
#3d ;draw-char JSR2 ( draws "[ ]" )
|
#3d ;draw-char JSR2 ( draws "[ ]" )
|
||||||
POPr ( remove octave from returnstack )
|
POPr ( remove octave from returnstack ) POP
|
||||||
POP
|
|
||||||
RTN
|
RTN
|
||||||
¬e
|
¬e
|
||||||
#0c MOD #00 SWP ;notes ADD2 LDA DUP #7f AND ;draw-char JSR2
|
#0c MOD #00 SWP ;notes ADD2 LDA DUP #7f AND ;draw-char JSR2
|
||||||
|
|
Reference in New Issue