Added state registers in ZP

This commit is contained in:
Devine Lu Linvega 2023-01-25 11:31:44 -08:00
parent fd551421c3
commit a5cf18f89f
1 changed files with 30 additions and 10 deletions

View File

@ -16,11 +16,13 @@
@cursor @cursor
&x $2 &y $2 &x $2 &y $2
@textarea @textarea
&fixed $1 &highlight $1 &lines $2 &length $2 &highlight $1 &lines $2 &length $2
@scrollbar @scrollbar
&height $2 &height $2
@scroll @scroll
&x $2 &y $2 &addr $2 &drag $2 &ratio $2 &x $2 &y $2 &addr $2 &drag $2 &ratio $2
@state
&c $1 &f $1
@nav @nav
&len $1 &len $1
&buf $60 &buf $60
@ -311,12 +313,15 @@ BRK
@touch-to-addr ( -- addr* ) @touch-to-addr ( -- addr* )
#0000 .state STZ2
( goto y ) ( goto y )
( b ) .Mouse/y DEI2 #0020 SUB2 #04 SFT2 NIP STH ( b ) .Mouse/y DEI2 #0020 SUB2 #04 SFT2 NIP STH
( a ) LITr 00 ( a ) LITr 00
.scroll/addr LDZ2 .scroll/addr LDZ2
&ver &ver
EQUkr STHr ?&ver-end EQUkr STHr ?&ver-end
scan-comment
scan-fixed
LDAk #0a NEQ JMP INCr LDAk #0a NEQ JMP INCr
INC2 LDAk ?&ver INC2 LDAk ?&ver
&ver-end &ver-end
@ -326,12 +331,14 @@ BRK
( a ) LIT2r 0000 ( a ) LIT2r 0000
&hor &hor
LDAk #0a EQU ?&hor-end LDAk #0a EQU ?&hor-end
walk-color POP scan-comment
scan-fixed
get-segw STH2 ADD2r get-segw STH2 ADD2r
LTH2kr STHr ?&hor-end LTH2kr STHr ?&hor-end
INC2 LDAk ?&hor INC2 LDAk ?&hor
&hor-end &hor-end
POP2r POP2r POP2r POP2r
#0000 .state STZ2
JMP2r JMP2r
@ -626,7 +633,7 @@ JMP2r
@is-rune ( addr* -- bool ) @is-rune ( addr* -- bool )
.textarea/highlight LDZ ?&skip .textarea/highlight LDZ ?&skip
;scan-comment/active LDA ?&skip .state/c LDZ ?&skip
INC2k LDA #21 LTH ?&skip INC2k LDA #21 LTH ?&skip
LDA ;runes cndx INC2 ORA LDA ;runes cndx INC2 ORA
@ -806,8 +813,7 @@ JMP2r
( setup ) ( setup )
.selection/from LDZ2 get-current-marker .selection/from LDZ2 get-current-marker
get-marker ;walk-color/scope STA2 get-marker ;walk-color/scope STA2
#00 ;scan-comment/active STA #0000 .state STZ2
( paint ) ( paint )
#0010 .scroll/x LDZ2 SUB2 #0080 ADD2 .Screen/x DEO2 #0010 .scroll/x LDZ2 SUB2 #0080 ADD2 .Screen/x DEO2
#0020 .Screen/y DEO2 #0020 .Screen/y DEO2
@ -815,11 +821,13 @@ JMP2r
get-eof INC2 .scroll/addr LDZ2 get-eof INC2 .scroll/addr LDZ2
&l &l
scan-comment scan-comment
scan-fixed
draw-token draw-token
.Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ?&end .Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ?&end
GTH2k ?&l GTH2k ?&l
&end &end
POP2 POP2 POP2 POP2
#0000 .state STZ2
!draw-scrollbar !draw-scrollbar
( .. ) ( .. )
@ -862,14 +870,24 @@ JMP2r
&skip &skip
JMP2r JMP2r
&true #01 ,&active STR JMP2r &true #01 .state/c STZ JMP2r
&false #00 ,&active STR JMP2r &false #00 .state/c STZ JMP2r
&active $1
@scan-fixed ( addr* -- addr* )
.textarea/highlight LDZ ?&skip
LDAk LIT "[ EQU ?&true
DUP2 #0001 SUB2 LDA LIT "] EQU ?&false
&skip
JMP2r
&true #01 .state/f STZ JMP2r
&false #00 .state/f STZ JMP2r
@walk-color ( addr* -- addr* color ) @walk-color ( addr* -- addr* color )
.textarea/highlight LDZ ?&skip .textarea/highlight LDZ ?&skip
;scan-comment/active LDA ?&comment .state/c LDZ ?&comment
DUP2 [ LIT2 &scope $2 ] EQU2 ?&parent DUP2 [ LIT2 &scope $2 ] EQU2 ?&parent
LDAk LIT "@ EQU ?&label LDAk LIT "@ EQU ?&label
LDAk LIT "& EQU ?&label LDAk LIT "& EQU ?&label
@ -1007,13 +1025,14 @@ JMP2r
@get-chr ( c -- addr* ) @get-chr ( c -- addr* )
.state/f LDZ ?&fixed
DUP #09 EQU ?&tab DUP #09 EQU ?&tab
#20 SUB #20 SUB
DUP #5e GTH ?&unknown DUP #5e GTH ?&unknown
#00 SWP #50 SFT2 ;font/glyphs ADD2 #00 SWP #50 SFT2 ;font/glyphs ADD2
JMP2r JMP2r
&fixed #00 SWP #20 SUB #40 SFT2 ;font-mono/glyphs ADD2 JMP2r &fixed #20 SUB #00 SWP #40 SFT2 ;font-mono/glyphs ADD2 JMP2r
&tab POP ;tab-icn JMP2r &tab POP ;tab-icn JMP2r
&unknown POP ;checkered-icn JMP2r &unknown POP ;checkered-icn JMP2r
@ -1040,6 +1059,7 @@ JMP2r
@get-chrw ( c -- width* ) @get-chrw ( c -- width* )
.state/f LDZ ?&fixed
DUP #7f GTH ?&unknown DUP #7f GTH ?&unknown
#0000 ROT ;font ADD2 LDA #0000 ROT ;font ADD2 LDA