(notepad) Walking to line

This commit is contained in:
Devine Lu Linvega 2023-04-26 20:44:04 -07:00
parent 5571680f3e
commit fe0d461997
1 changed files with 34 additions and 19 deletions

View File

@ -310,31 +310,46 @@ JMP2r
JMP2r JMP2r
@pos-to-line ( y* -- line )
#0018 SUB2 #04 SFT2 NIP
JMP2r
@get-position ( -- addr* ) @get-position ( -- addr* )
#0008 .Screen/x DEO2 #0008 .Screen/x DEO2
#0018 .Screen/y DEO2 #0018 .Screen/y DEO2
( walk to line )
.Mouse/y DEI2 pos-to-line ,&line STR
;mem ;mem
&while &while
.Screen/y DEI2 pos-to-line [ LIT &line $1 ] EQU ?&end
walk-char
INC2 LDAk ?&while
&end
( walk to char )
JMP2r
@walk-char ( addr* -- addr* )
( wrap ) ( wrap )
LDAk #20 GTH ?&no-wrap LDAk #20 GTH ?&no-wrap
DUP2 word-length .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap DUP2 word-length .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap
draw-linebreak !draw-linebreak
INC2 LDAk walk-on AND ?&while JMP2r
&no-wrap &no-wrap
( char )
LDAk #20 SUB #00 SWP ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 LDAk #20 SUB #00 SWP ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
.Screen/x DEO2 .Screen/x DEO2
( tab ) ( tab )
LDAk #09 NEQ ?&no-tab LDAk #09 NEQ ?&no-tab
draw-tab !draw-tab
INC2 LDAk walk-on AND ?&while JMP2r
&no-tab &no-tab
( linebreak ) ( linebreak )
LDAk #0a NEQ ?&no-lb LDAk #0a NEQ ?&no-lb
draw-linebreak !draw-linebreak
INC2 LDAk walk-on AND ?&while JMP2r
&no-lb &no-lb
INC2 LDAk walk-on AND ?&while
JMP2r JMP2r