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 RTN
@handle-cursor ( controller -- ) ( handles moving the cursor around ) @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 #20 AND ,&down JCN
DUP #40 AND ,&left JCN DUP #40 AND ,&left JCN
#80 AND ,&right JCN #80 AND ,&right JCN
RTN ( if none are pressed, break ) RTN ( if none are pressed, break )
&up &up
POP ( pop the controller )
#00 .Edit/selection-y LDZ EQU ,&end JCN #00 .Edit/selection-y LDZ EQU ,&end JCN
.Edit/selection-y LDZ #01 SUB .Edit/selection-y STZ .Edit/selection-y LDZ #01 SUB .Edit/selection-y STZ
RTN RTN
&down &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 .Edit/selection-y LDZ #01 ADD .Edit/selection-y STZ
RTN RTN
&left &left
POP
#00 .Edit/selection-x LDZ EQU ,&end JCN #00 .Edit/selection-x LDZ EQU ,&end JCN
.Edit/selection-x LDZ #01 SUB .Edit/selection-x STZ .Edit/selection-x LDZ #01 SUB .Edit/selection-x STZ
RTN RTN
&right &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 .Edit/selection-x LDZ #01 ADD .Edit/selection-x STZ
&end &end
RTN RTN
@ -163,6 +167,7 @@ RTN
( switching patterns. TODO bounds checking. TODO move into seperate routine ) ( switching patterns. TODO bounds checking. TODO move into seperate routine )
DUP #3e EQU ,&next JCN DUP #3e EQU ,&next JCN
DUP #3c EQU ,&prev JCN DUP #3c EQU ,&prev JCN
POP
BRK BRK
&next &next
POP POP