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