add basic editing features
This commit is contained in:
parent
81d67543e7
commit
60b0f24e46
31
main.usm
31
main.usm
|
@ -74,29 +74,48 @@
|
|||
#08 .Edit/selection-y STZ
|
||||
BRK
|
||||
|
||||
@on-button ( -> )
|
||||
.Controller/button DEI ( get button )
|
||||
@get-selected-addr ( -- addr* ) ( get the address of the current selection in the pattern )
|
||||
.Playback/pattern-addr LDZ2 #00 .Edit/selection-x LDZ ADD2 #00 .Edit/selection-y LDZ PTN_WIDTH MUL2 ADD2
|
||||
RTN
|
||||
|
||||
@handle-cursor ( controller -- ) ( handles moving the cursor around )
|
||||
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 )
|
||||
RTN ( 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
|
||||
RTN
|
||||
&down
|
||||
PTN_LEN #01 SUB .Edit/selection-y LDZ EQU ,&end JCN
|
||||
.Edit/selection-y LDZ #01 ADD .Edit/selection-y STZ
|
||||
BRK
|
||||
RTN
|
||||
&left
|
||||
#00 .Edit/selection-x LDZ EQU ,&end JCN
|
||||
.Edit/selection-x LDZ #01 SUB .Edit/selection-x STZ
|
||||
BRK
|
||||
RTN
|
||||
&right
|
||||
PTN_WIDTH #01 SUB .Edit/selection-x LDZ EQU ,&end JCN
|
||||
.Edit/selection-x LDZ #01 ADD .Edit/selection-x STZ
|
||||
&end
|
||||
RTN
|
||||
|
||||
@on-button ( -> )
|
||||
.Controller/key DEI
|
||||
DUP #2b EQU ,&plus JCN
|
||||
DUP #2d EQU ,&minus JCN
|
||||
.Controller/button DEI ( get button )
|
||||
;handle-cursor JSR2
|
||||
BRK
|
||||
&plus
|
||||
;get-selected-addr JSR2 DUP2 STH2 LDA #01 ADD STH2r STA POP2
|
||||
BRK
|
||||
&minus
|
||||
;get-selected-addr JSR2 DUP2 STH2 LDA #01 SUB STH2r STA POP2
|
||||
BRK
|
||||
&end
|
||||
BRK
|
||||
|
||||
@on-frame ( -> )
|
||||
|
|
Reference in New Issue