fix overflows in input

This commit is contained in:
Nico 2021-05-26 16:51:12 +01:00
parent 5376dc505a
commit d053a12c0e
1 changed files with 8 additions and 3 deletions

View File

@ -112,25 +112,29 @@ RTN
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 #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
RTN ( if none are pressed, break )
&up
POP ( pop the controller )
#00 .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 SUB .Edit/selection-y STZ
RTN
&down
PTN_LEN #01 SUB .Edit/selection-y LDZ EQU ,&end JCN
POP2
PTN_LEN #0001 SUB2 .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 ADD .Edit/selection-y STZ
RTN
&left
POP
#00 .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 SUB .Edit/selection-x STZ
RTN
&right
PTN_WIDTH #01 SUB .Edit/selection-x LDZ EQU ,&end JCN
POP
PTN_WIDTH #0001 SUB2 .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 ADD .Edit/selection-x STZ
&end
RTN
@ -163,6 +167,7 @@ RTN
( switching patterns. TODO bounds checking. TODO move into seperate routine )
DUP #3e EQU ,&next JCN
DUP #3c EQU ,&prev JCN
POP
BRK
&next
POP