make the cursor move

This commit is contained in:
Nico 2021-05-12 18:35:30 +01:00
parent d6d0e52369
commit ed444ac6a0
1 changed files with 28 additions and 0 deletions

View File

@ -59,6 +59,7 @@
( display/audio init )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
#0180 .Audio0/adsr DEO2
;wave .Audio0/addr DEO2
#0002 .Audio0/length DEO2
@ -69,8 +70,35 @@
#0004 .Draw/pattern-vspacing STZ2
#0007 .Draw/playhead-x STZ2
#0004 .Draw/pattern-hspacing STZ2
#08 .Edit/selection-y STZ
BRK
@on-button ( -> )
.Controller/button DEI ( get button )
DUP #10 AND #00 NEQ ,&up JCN ( check the if the four directions are pressed )
DUP #20 AND ,&down JCN
DUP #40 AND ,&left JCN
#80 AND ,&right JCN
BRK ( if none are pressed, break )
&up
#00 .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 SUB .Edit/selection-y STZ
BRK
&down
PTN_LEN #01 SUB .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 ADD .Edit/selection-y STZ
BRK
&left
#00 .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 SUB .Edit/selection-x STZ
BRK
&right
PTN_WIDTH #01 SUB .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 ADD .Edit/selection-x STZ
&end
BRK
@on-frame ( -> )
;draw JSR2
.Playback/tick LDZ .Playback/speed LDZ NEQ ,&inc JCN ( if the tick != speed, skip to inc )