better effect docs

This commit is contained in:
~d6 2023-02-11 21:53:34 -05:00
parent e467dc0164
commit 56200a1c59
1 changed files with 47 additions and 53 deletions

100
term.tal
View File

@ -129,8 +129,6 @@
( 80 cols x 24 rows + 1 col for padding ) ( 80 cols x 24 rows + 1 col for padding )
#0018 .rows STZ2 #0018 .rows STZ2
#0051 .cols STZ2 #0051 .cols STZ2
( #0024 .rows STZ2
#005b .cols STZ2 )
( set initial cursor ) ( set initial cursor )
#0000 .cur-x STZ2 #0000 .cur-x STZ2
@ -146,8 +144,11 @@
#07bf .System/r DEO2 #07bf .System/r DEO2
#07bf .System/g DEO2 #07bf .System/g DEO2
#07bf .System/b DEO2 #07bf .System/b DEO2
( load theme to override colors and maybe dimension )
load-theme load-theme
( calculate derived dimensions from cols/rows )
update-dimensions update-dimensions
( set starting tint: reverse=0, bg=0, fg=2 ) ( set starting tint: reverse=0, bg=0, fg=2 )
@ -251,7 +252,7 @@
LTH2 ?&yloop ( y+1* [addr*] ) LTH2 ?&yloop ( y+1* [addr*] )
POP2 POP2r JMP2r ( ) POP2 POP2r JMP2r ( )
@redraw ( -> ) @redraw ( -> BRK )
.dirty LDZ #00 EQU ?&done .dirty LDZ #00 EQU ?&done
LIT2r =cells ( [addr*] ) LIT2r =cells ( [addr*] )
.rows LDZ2 #0000 DUP2 #0008 ( border ) ADD2 .Screen/y DEO2 .rows LDZ2 #0000 DUP2 #0008 ( border ) ADD2 .Screen/y DEO2
@ -301,7 +302,7 @@
.tcem LDZ #00 EQU ?&skip SWP reverse-tint SWP .tcem LDZ #00 EQU ?&skip SWP reverse-tint SWP
&skip !draw-cell &skip !draw-cell
@on-button ( -> ) @on-button ( -> BRK )
.lastkey LDZ ( last^ ) .lastkey LDZ ( last^ )
.Controller/button DEI ( last^ button^ ) .Controller/button DEI ( last^ button^ )
STHk EOR ( last-xor-button^ [button^] ) STHk EOR ( last-xor-button^ [button^] )
@ -513,7 +514,7 @@
screen-to-cursor ( ) screen-to-cursor ( )
JMP2r ( ) JMP2r ( )
@on-mouse ( -> ) @on-mouse ( -> BRK )
.lastmouse-st LDZ ( last ) .lastmouse-st LDZ ( last )
.Mouse/state DEI ( last st ) .Mouse/state DEI ( last st )
STHk OVR EOR STHkr AND ( last (last^st)&st [st] ) STHk OVR EOR STHkr AND ( last (last^st)&st [st] )
@ -523,7 +524,7 @@
STHr .lastmouse-st STZ ( ) STHr .lastmouse-st STZ ( )
on-move BRK ( ) on-move BRK ( )
@on-key ( -> ) @on-key ( -> BRK )
.Controller/key DEI ?&ok !on-button .Controller/key DEI ?&ok !on-button
&ok alt ?on-alt-key &ok alt ?on-alt-key
ctrl ?on-ctrl-key ctrl ?on-ctrl-key
@ -536,7 +537,7 @@
@alt ( -> is-down? ) .Controller/button DEI #02 AND JMP2r @alt ( -> is-down? ) .Controller/button DEI #02 AND JMP2r
( alt-XYZ emits ESC and then emits XYZ ) ( alt-XYZ emits ESC and then emits XYZ )
@on-alt-key ( -> ) @on-alt-key ( -> BRK )
#1b .Console/w DEO #1b .Console/w DEO
ctrl ?on-ctrl-key ctrl ?on-ctrl-key
.Controller/key DEI .Console/w DEO BRK .Controller/key DEI .Console/w DEO BRK
@ -545,7 +546,7 @@
( 0 <= $n < @ -> $n ) ( 0 <= $n < @ -> $n )
( @ <= $n < ` -> $n #40 SUB ) ( @ <= $n < ` -> $n #40 SUB )
( ` <= $n <= #ff -> $n #60 SUB ) ( ` <= $n <= #ff -> $n #60 SUB )
@on-ctrl-key ( -> ) @on-ctrl-key ( -> BRK )
.Controller/key DEI .Controller/key DEI
DUP LIT "@ LTH ?&done DUP LIT "@ LTH ?&done
DUP LIT "` LTH ?&c1 DUP LIT "` LTH ?&c1
@ -553,17 +554,17 @@
&c1 LIT "@ SUB &c1 LIT "@ SUB
&done .Console/w DEO BRK &done .Console/w DEO BRK
@on-read-priv @on-read-priv ( -> BRK )
.Console/r DEI .Console/r DEI
DUP LIT "; EQU ?next-arg DUP LIT "; EQU ?next-arg
DUP LIT "0 LTH ?end-arg-priv DUP LIT "0 LTH ?end-arg-priv
DUP LIT "9 GTH ?end-arg-priv DUP LIT "9 GTH ?end-arg-priv
!add-to-arg !add-to-arg
@start-priv @start-priv ( -> BRK )
POP ;on-read-priv .Console/vect DEO2 BRK POP ;on-read-priv .Console/vect DEO2 BRK
@on-read-csi ( -> ) @on-read-csi ( -> BRK )
.Console/r DEI .Console/r DEI
DUP LIT "? EQU ?start-priv DUP LIT "? EQU ?start-priv
DUP LIT "; EQU ?next-arg DUP LIT "; EQU ?next-arg
@ -571,7 +572,7 @@
DUP LIT "9 GTH ?end-arg DUP LIT "9 GTH ?end-arg
!add-to-arg !add-to-arg
@on-read-osc ( -> ) @on-read-osc ( -> BRK )
.Console/r DEI .Console/r DEI
DUP #07 ( bell ) EQU ?&end-osc DUP #07 ( bell ) EQU ?&end-osc
#9c ( esc-\ ) EQU ?&end-osc BRK #9c ( esc-\ ) EQU ?&end-osc BRK
@ -608,7 +609,7 @@
;scratch .File1/w DEO2 ;scratch .File1/w DEO2
JMP2r JMP2r
@end-arg-priv ( c^ -> ) @end-arg-priv ( c^ -> BRK )
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
DUP LIT "h EQU ?exec-priv-set-or-unset DUP LIT "h EQU ?exec-priv-set-or-unset
DUP LIT "l EQU ?exec-priv-set-or-unset DUP LIT "l EQU ?exec-priv-set-or-unset
@ -616,7 +617,7 @@
( TODO: handle these ) ( TODO: handle these )
POP BRK POP BRK
@exec-priv-set-or-unset ( c^ -> ) @exec-priv-set-or-unset ( c^ -> BRK )
#0001 read-arg-1 ( c^ n* ) #0001 read-arg-1 ( c^ n* )
DUP2 #0019 NEQ2 ?&!25 POP2 .tcem !&change DUP2 #0019 NEQ2 ?&!25 POP2 .tcem !&change
&!25 DUP2 #07d4 NEQ2 ?&!2004 POP2 .paste !&change &!25 DUP2 #07d4 NEQ2 ?&!2004 POP2 .paste !&change
@ -648,7 +649,7 @@
;scratch .File1/w DEO2 ;scratch .File1/w DEO2
JMP2r JMP2r
@end-arg ( c^ -> ) @end-arg ( c^ -> BRK )
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
DUP debug-csi DUP debug-csi
DUP LIT "d EQU ?exec-move-row ( move cursor to row ) DUP LIT "d EQU ?exec-move-row ( move cursor to row )
@ -677,19 +678,19 @@
( = 1 C - bold cursor ) ( = 1 C - bold cursor )
debug-csi BRK debug-csi BRK
@exec-noop ( c^ -> ) @exec-noop ( c^ -> BRK )
POP BRK POP BRK
( set mode ) ( set mode )
( TODO: insert/replace, line wrap, etc. ) ( TODO: insert/replace, line wrap, etc. )
@exec-set-mode ( c^ -> ) @exec-set-mode ( c^ -> BRK )
POP #0001 read-arg-1 POP #0001 read-arg-1
DUP2 #0004 NEQ2 ?&!irm POP2 .irm !&set DUP2 #0004 NEQ2 ?&!irm POP2 .irm !&set
&!irm DUP2 #0007 NEQ2 ?&!awm POP2 .awm !&set &!irm DUP2 #0007 NEQ2 ?&!awm POP2 .awm !&set
&!awm POP2 BRK &!awm POP2 BRK
&set #01 SWP STZ BRK &set #01 SWP STZ BRK
@exec-reset-mode ( c^ -> ) @exec-reset-mode ( c^ -> BRK )
POP #0001 read-arg-1 POP #0001 read-arg-1
DUP2 #0004 NEQ2 ?&!irm POP2 .irm !&reset DUP2 #0004 NEQ2 ?&!irm POP2 .irm !&reset
&!irm DUP2 #0007 NEQ2 ?&!awm POP2 .awm !&reset &!irm DUP2 #0007 NEQ2 ?&!awm POP2 .awm !&reset
@ -707,7 +708,7 @@
&done update-tint &done update-tint
&ignored POP2 JMP2r &ignored POP2 JMP2r
@exec-set-attr ( c^ -> ) @exec-set-attr ( c^ -> BRK )
POP POP
;args/pos LDA2 ;args ;args/pos LDA2 ;args
&loop &loop
@ -717,10 +718,10 @@
&done &done
POP2 POP2 BRK POP2 POP2 BRK
@exec1 ( addr* -> ) @exec1 ( addr* -> BRK )
STH2 #0001 read-arg-1 STH2r JSR2 BRK STH2 #0001 read-arg-1 STH2r JSR2 BRK
@exec-status @exec-status ( c^ -> BRK )
POP #0000 read-arg-1 #0006 NEQ2 ,&done POP #0000 read-arg-1 #0006 NEQ2 ,&done
#1b .Console/w DEO #1b .Console/w DEO
LIT "[ .Console/w DEO LIT "[ .Console/w DEO
@ -740,7 +741,7 @@
@exec-insert-lines POP ;insert-n-lines !exec1 @exec-insert-lines POP ;insert-n-lines !exec1
@exec-forward-tabs POP ;forward-n-tabs !exec1 @exec-forward-tabs POP ;forward-n-tabs !exec1
@exec-erase-line @exec-erase-line ( c^ -> BRK )
POP #0000 read-arg-1 POP #0000 read-arg-1
DUP2 #0000 EQU2 ?&erase-to-end DUP2 #0000 EQU2 ?&erase-to-end
DUP2 #0001 EQU2 ?&erase-from-start DUP2 #0001 EQU2 ?&erase-from-start
@ -753,7 +754,7 @@
&erase-from-start &erase-from-start
POP2 bol-addr cur-addr erase BRK POP2 bol-addr cur-addr erase BRK
@exec-erase-screen @exec-erase-screen ( c^ -> BRK )
POP #0000 read-arg-1 POP #0000 read-arg-1
DUP2 #0000 EQU2 ?&erase-to-end DUP2 #0000 EQU2 ?&erase-to-end
DUP2 #0001 EQU2 ?&erase-from-start DUP2 #0001 EQU2 ?&erase-from-start
@ -779,19 +780,19 @@
JMP2r ( ) JMP2r ( )
&skip POP2 POP2 JMP2r ( ) &skip POP2 POP2 JMP2r ( )
@exec-move-row ( c^ -> ) @exec-move-row ( c^ -> BRK )
POP POP
#0001 read-arg-1 dec-floor ( row ) #0001 read-arg-1 dec-floor ( row )
.cur-x LDZ2 ( col ) .cur-x LDZ2 ( col )
goto BRK goto BRK
@exec-move-col ( c^ -> ) @exec-move-col ( c^ -> BRK )
POP POP
.cur-y LDZ2 ( row ) .cur-y LDZ2 ( row )
#0001 read-arg-1 dec-floor ( col ) #0001 read-arg-1 dec-floor ( col )
goto BRK goto BRK
@exec-move ( c^ -> ) @exec-move ( c^ -> BRK )
POP POP
#0001 read-arg-1 dec-floor ( row ) #0001 read-arg-1 dec-floor ( row )
#0001 read-arg-2 dec-floor ( col ) #0001 read-arg-2 dec-floor ( col )
@ -812,7 +813,7 @@
;scratch .File1/w DEO2 ;scratch .File1/w DEO2
JMP2r JMP2r
@on-read-esc ( -> ) @on-read-esc ( -> BRK )
.Console/r DEI .Console/r DEI
DUP debug-esc DUP debug-esc
DUP LIT "[ EQU ?start-csi DUP LIT "[ EQU ?start-csi
@ -826,7 +827,7 @@
!on-read !on-read
&skip POP ;on-read .Console/vect DEO2 BRK &skip POP ;on-read .Console/vect DEO2 BRK
@on-read-skip ( -> ) @on-read-skip ( -> BRK )
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
BRK BRK
@ -834,28 +835,28 @@
( ')' = designate G1 charset ) ( ')' = designate G1 charset )
( '*' = designate G2 charset ) ( '*' = designate G2 charset )
( '+' = designate G3 charset ) ( '+' = designate G3 charset )
@start-charset ( c^ -> ) @start-charset ( c^ -> BRK )
POP ;on-read-skip .Console/vect DEO2 BRK POP ;on-read-skip .Console/vect DEO2 BRK
@start-csi ( c^ -> ) @start-csi ( c^ -> BRK )
POP reset-args ;on-read-csi .Console/vect DEO2 BRK POP reset-args ;on-read-csi .Console/vect DEO2 BRK
@start-osc ( c^ -> ) @start-osc ( c^ -> BRK )
POP reset-args ;on-read-osc .Console/vect DEO2 BRK POP reset-args ;on-read-osc .Console/vect DEO2 BRK
@on-read ( -> ) @on-read ( -> BRK )
.Console/r DEI .Console/r DEI
DUP debug-read DUP debug-read
DUP ?&ok POP BRK DUP ?&ok POP BRK
&ok ( #42 .tint STZ ) &ok ( #42 .tint STZ )
!read !read
@read ( c^ -> ) @read ( c^ -> BRK )
DUP #20 LTH ?read-ctrl DUP #20 LTH ?read-ctrl
DUP #7f EQU ?read-del DUP #7f EQU ?read-del
!read-printable !read-printable
@read-ctrl ( c^ -> ) @read-ctrl ( c^ -> BRK )
DUP #07 EQU ?read-bel DUP #07 EQU ?read-bel
DUP #08 EQU ?read-bs DUP #08 EQU ?read-bs
DUP #09 EQU ?read-tab DUP #09 EQU ?read-tab
@ -863,26 +864,25 @@
DUP #0d EQU ?read-cr DUP #0d EQU ?read-cr
DUP #1b EQU ?read-esc DUP #1b EQU ?read-esc
@read-bel ( 07 -> ) @read-bel ( 07 -> BRK )
POP .visual-bell LDZ #00 EQU ?&done POP .visual-bell LDZ #00 EQU ?&done
#06 .flash STZ #01 .dirty STZ #06 .flash STZ #01 .dirty STZ
&done BRK &done BRK
@read-bs ( 08 -> ) @read-bs ( 08 -> BRK )
POP POP
clear-cursor clear-cursor
#0001 back-n #0001 back-n
draw-cursor draw-cursor
BRK BRK
@read-esc ( 1b -> ) @read-esc ( 1b -> BRK )
POP ;on-read-esc .Console/vect DEO2 BRK POP ;on-read-esc .Console/vect DEO2 BRK
@read-del ( 7f -> ) @read-del ( 7f -> BRK )
POP BRK POP BRK
( @read-tab POP JMP2r ) @read-tab ( 09 -> BRK )
@read-tab
POP POP
.cur-x LDZ2 ( x* ) .cur-x LDZ2 ( x* )
NIP #07 AND #08 SUB ( i=(xlo&7)-8^ ) NIP #07 AND #08 SUB ( i=(xlo&7)-8^ )
@ -894,17 +894,17 @@
INC DUP ?&loop ( i+1^ ) INC DUP ?&loop ( i+1^ )
POP BRK ( ) POP BRK ( )
@read-cr ( 0d -> ) @read-cr ( 0d -> BRK )
POP clear-cursor #0000 .cur-x STZ2 draw-cursor BRK POP clear-cursor #0000 .cur-x STZ2 draw-cursor BRK
@at-max-y ( -> true? ) @at-max-y ( -> true? )
.cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r .cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r
@read-nl ( 0a -> ) @read-nl ( 0a -> BRK )
POP clear-cursor POP clear-cursor
at-max-y ?scroll down BRK at-max-y ?scroll down BRK
@read-printable ( c -> ) @read-printable ( c^ -> BRK )
.tint LDZ SWP DUP2 cur-addr STA2 .tint LDZ SWP DUP2 cur-addr STA2
draw-cell draw-cell
forward BRK forward BRK
@ -954,7 +954,7 @@
cur-addr ( cell* last* cur* ) cur-addr ( cell* last* cur* )
&loop ( cell* last* pos* ) &loop ( cell* last* pos* )
LDA2k OVR2 INC2 STA2 ( cell* last* pos* ; pos+1<-pos ) LDA2k OVR2 INC2 STA2 ( cell* last* pos* ; pos+1<-pos )
INC2 LTH2k ?&loop ( cell* last pos+1* ) INC2 GTH2k ?&loop ( cell* last pos+1* )
POP2 POP2 ( cell* ) POP2 POP2 ( cell* )
&replace ( cell* ) &replace ( cell* )
cur-addr STA2 JMP2r ( ) cur-addr STA2 JMP2r ( )
@ -1019,7 +1019,7 @@
eol-addr ( limit* start* [n*] ) eol-addr ( limit* start* [n*] )
!delete-n-chars/loop !delete-n-chars/loop
@scroll @scroll ( -> BRK )
limit-addr STH2 limit-addr STH2
;cells .col-bytes LDZ2 ADD2 STH2 ;cells .col-bytes LDZ2 ADD2 STH2
&loop &loop
@ -1030,12 +1030,6 @@
#01 .dirty STZ #01 .dirty STZ
draw-cursor BRK draw-cursor BRK
( ( 0 <= index < 128 )
@load-tile ( index^ -> )
#00 SWP #30 SFT2 ( size in bytes )
;ascii ADD2 .Screen/addr DEO2
JMP2r )
( bits: Rx xx FF BB ) ( bits: Rx xx FF BB )
( - R: reversed [0=normal, 1=reversed] ) ( - R: reversed [0=normal, 1=reversed] )
( - F: foreground [0:black, 1:dim, 2:normal, 3:bright] ) ( - F: foreground [0:black, 1:dim, 2:normal, 3:bright] )
@ -1092,12 +1086,12 @@
.Screen/y DEI2k #0004 SUB2 ROT DEO2 ( ) .Screen/y DEI2k #0004 SUB2 ROT DEO2 ( )
JMP2r ( ) JMP2r ( )
@next-arg ( c^ -> ) @next-arg ( c^ -> BRK )
POP POP
( TODO: check if we already have max args ) ( TODO: check if we already have max args )
;args/pos LDA2k INC2 INC2 SWP2 STA2 BRK ;args/pos LDA2k INC2 INC2 SWP2 STA2 BRK
@add-to-arg ( c^ -> ) @add-to-arg ( c^ -> BRK )
LIT "0 SUB LITr 00 STH ( [digit*] ) LIT "0 SUB LITr 00 STH ( [digit*] )
;args/pos LDA2 LDA2k ( addr* value* [digit*] ) ;args/pos LDA2 LDA2k ( addr* value* [digit*] )
#000a MUL2 STH2r ADD2 ( addr* value*10+digit ) #000a MUL2 STH2r ADD2 ( addr* value*10+digit )