From ed444ac6a0c98715fe6a1f870b4b90977324003e Mon Sep 17 00:00:00 2001 From: Nihilazo Date: Wed, 12 May 2021 18:35:30 +0100 Subject: [PATCH] make the cursor move --- main.usm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/main.usm b/main.usm index a654706..42b819e 100644 --- a/main.usm +++ b/main.usm @@ -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 )