add backspace to zero field, fix input stack effects

This commit is contained in:
Nico 2021-05-31 17:50:23 +01:00
parent 051479be07
commit 31e04e1665
1 changed files with 13 additions and 6 deletions

View File

@ -115,7 +115,8 @@ RTN
DUP #10 AND ,&up JCN ( check the if the four directions are pressed )
DUP #20 AND ,&down JCN
DUP #40 AND ,&left JCN
#80 AND ,&right JCN
DUP #80 AND ,&right JCN
POP
RTN ( if none are pressed, break )
&up
POP ( pop the controller )
@ -123,8 +124,8 @@ RTN
.Edit/selection-y LDZ #01 SUB .Edit/selection-y STZ
RTN
&down
POP2
PTN_LEN #0001 SUB2 .Edit/selection-y LDZ EQU ,&end JCN
POP
PTN_LEN #0001 SUB2 LOB .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 ADD .Edit/selection-y STZ
RTN
&left
@ -134,14 +135,16 @@ RTN
RTN
&right
POP
PTN_WIDTH #0001 SUB2 .Edit/selection-x LDZ EQU ,&end JCN
PTN_WIDTH #0001 SUB2 LOB .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 ADD .Edit/selection-x STZ
&end
RTN
@handle-editing ( key -- )
DUP #2b EQU ,&plus JCN
#2d EQU ,&minus JCN
DUP #2d EQU ,&minus JCN
DUP #08 EQU ,&bksp JCN
POP
RTN
&plus
POP ( pop the key )
@ -150,10 +153,15 @@ RTN
LDA #01 ADD STH2r STA
RTN
&minus
POP
#00 .Edit/selection-x LDZ EQU ;get-selected-addr JSR2 LDA #0c EQU AND ,&end JCN ( if we're on a note and out of bounds, skip moving )
;get-selected-addr JSR2 DUP2 STH2 ( stash selection address and keep another copy on the stack )
LDA #01 SUB STH2r STA
RTN
&bksp
POP
#00 ;get-selected-addr JSR2 STA
RTN
&end
RTN
@ -176,7 +184,6 @@ RTN
BRK
&prev
POP
.Playback/pattern-index LDZ #01 SUB .Playback/pattern-index STZ
.Playback/pattern-index LDZ ;alloc-load-pattern JSR2
BRK