clean up, add TODOs, etc.

This commit is contained in:
~d6 2023-11-11 22:39:17 -05:00
parent c02eebd096
commit 2e510dc278
1 changed files with 84 additions and 64 deletions

148
term.tal
View File

@ -121,8 +121,8 @@
( user configuration ) ( user configuration )
@debug $1 ( use debug log? ) @debug $1 ( use debug log? )
@show-banner $1 ( show banner on startup? ) @show-banner $1 ( show banner on startup? )
@visual-bell $1 ( flash visual bell? otherwise do nothing ) @visual-bell $1 ( use visual belL? 01: visual bell, 00: do nothing )
@border-pad $2 ( use border? should be 0000 or 0010 ) @border-pad $2 ( use border? must be either 0000 or 0010 )
|0100 |0100
( metadata ) ( metadata )
@ -132,7 +132,6 @@
( user configuration defaults ) ( user configuration defaults )
#00 .debug STZ #00 .debug STZ
#01 .show-banner STZ #01 .show-banner STZ
( #0010 .border-pad STZ2 )
#0000 .border-pad STZ2 #0000 .border-pad STZ2
#01 .visual-bell STZ #01 .visual-bell STZ
@ -183,8 +182,7 @@
@reset-terminal ( -> ) @reset-terminal ( -> )
( set initial cursor ) ( set initial cursor )
#0000 .cur-x STZ2 #0000 DUP2 .cur-x STZ2 .cur-y STZ2
#0000 .cur-y STZ2
( confirm no buttons pressed yet ) ( confirm no buttons pressed yet )
#00 .lastkey STZ #00 .lastkey STZ
@ -193,8 +191,7 @@
update-dimensions update-dimensions
( set starting tint: reverse=0, bg=0, fg=2 ) ( set starting tint: reverse=0, bg=0, fg=2 )
#02 .attr STZ #02 .attr STZ update-tint
update-tint
( set initial modes ) ( set initial modes )
#00 .irm STZ ( insert and move right ) #00 .irm STZ ( insert and move right )
@ -202,11 +199,8 @@
#01 .tcem STZ ( show cursor ) #01 .tcem STZ ( show cursor )
#00 .paste STZ ( bracketed paste is off ) #00 .paste STZ ( bracketed paste is off )
( prepare for initial draw ) init-screen ( ; prepare for initial draw )
init-screen draw-border ( ; draw border )
( draw border )
.border-pad LDZ2 ORA ?draw-border
JMP2r JMP2r
@update-dimensions ( -> ) @update-dimensions ( -> )
@ -290,6 +284,7 @@
.Screen/y DEO2 JMP2r ( ; s/y<-y ) .Screen/y DEO2 JMP2r ( ; s/y<-y )
@draw-border ( -> ) @draw-border ( -> )
.border-pad LDZ2 ORA ?{ JMP2r }
;cp437/space .Screen/addr DEO2 ;cp437/space .Screen/addr DEO2
#04 .Screen/sprite #04 .Screen/sprite
#0000 draw-border/row #0000 draw-border/row
@ -752,41 +747,51 @@
@end-arg ( c^ -> BRK ) @end-arg ( c^ -> BRK )
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
DUP debug-csi DUP debug-csi
DUP LIT "@ EQU ?exec-ich ( insert blank characters ) DUP LIT "@ EQU ?exec-ich ( ICH: insert blank characters )
DUP LIT "A EQU ?exec-cuu ( up ) ( TODO ($n-sp-@) SL: shift left $n cols )
DUP LIT "B EQU ?exec-cud ( down ) DUP LIT "A EQU ?exec-cuu ( CUU: up )
DUP LIT "C EQU ?exec-cuf ( forward ) ( TODO ($n-sp-A) SR: shift right $n cols )
DUP LIT "D EQU ?exec-cub ( back ) DUP LIT "B EQU ?exec-cud ( CUD: down )
DUP LIT "E EQU ?exec-cnl ( next line $n times ) DUP LIT "C EQU ?exec-cuf ( CUF: forward )
DUP LIT "F EQU ?exec-cpl ( prev line $n times ) DUP LIT "D EQU ?exec-cub ( CUB: back )
DUP LIT "G EQU ?exec-cha ( move cursor to col ) DUP LIT "E EQU ?exec-cnl ( CNL: next line $n times )
DUP LIT "H EQU ?exec-cup ( move cursor ) DUP LIT "F EQU ?exec-cpl ( CPL: prev line $n times )
DUP LIT "I EQU ?exec-cht ( forward by tab stops ) DUP LIT "G EQU ?exec-cha ( CHA: move cursor to abs col )
DUP LIT "J EQU ?exec-ed ( erase screen ) DUP LIT "H EQU ?exec-cup ( CUP: move cursor [row;col] )
DUP LIT "K EQU ?exec-el ( erase line ) DUP LIT "I EQU ?exec-cht ( CHT: forward by tab stops )
DUP LIT "L EQU ?exec-il ( insert blank lines ) DUP LIT "J EQU ?exec-ed ( ED: erase display )
DUP LIT "M EQU ?exec-dl ( delete n lines ) DUP LIT "K EQU ?exec-el ( EL: erase line )
DUP LIT "P EQU ?exec-dch ( delete n chars ) DUP LIT "L EQU ?exec-il ( IL: insert $n blank lines )
DUP LIT "S EQU ?exec-su ( scroll up ) DUP LIT "M EQU ?exec-dl ( DL: delete $n lines )
DUP LIT "T EQU ?exec-sd ( scroll down ) DUP LIT "P EQU ?exec-dch ( DCH: delete n chars )
DUP LIT "X EQU ?exec-ech ( erase $n characters ) DUP LIT "S EQU ?exec-su ( SU: scroll up )
DUP LIT "Z EQU ?exec-cbt ( backward by tab stops ) DUP LIT "T EQU ?exec-sd ( SD: scroll down )
DUP LIT "` EQU ?exec-hpa ( char pos abs col=$n ) DUP LIT "X EQU ?exec-ech ( ECH: erase $n characters )
DUP LIT "a EQU ?exec-hpr ( char pos rel col=$n ) DUP LIT "Z EQU ?exec-cbt ( CBT: backward by tab stops )
DUP LIT "d EQU ?exec-vpa ( move cursor to row ) DUP LIT "` EQU ?exec-hpa ( HPA: char pos abs col=$n )
DUP LIT "e EQU ?exec-vpr ( line pos rel row+=$n ) DUP LIT "a EQU ?exec-hpr ( HPR: char pos rel col=$n )
DUP LIT "g EQU ?exec-tbc ( clear tab stops ) ( TODO: b - REP: repeat previous graphic char $n times )
DUP LIT "h EQU ?exec-sm ( set mode ) ( TODO: c - DA: send device attributes )
DUP LIT "l EQU ?exec-rm ( reset mode ) DUP LIT "d EQU ?exec-vpa ( VPA: move cursor to row )
DUP LIT "m EQU ?exec-sgr ( set graphical rendering ) DUP LIT "e EQU ?exec-vpr ( VPR: line pos rel row+=$n )
DUP LIT "n EQU ?exec-dsr ( device status reports ) ( TODO: $r;$c f - HVP: horizontal/vertical position )
DUP LIT "r EQU ?exec-set-scrolling-region DUP LIT "g EQU ?exec-tbc ( TBC: clear tab stops )
DUP LIT "s EQU ?exec-scosc ( saved current cursor position ) DUP LIT "h EQU ?exec-sm ( SM: set mode )
DUP LIT "u EQU ?exec-scorc ( restore saved cursor position ) ( TODO: ?-$n-h - DECSET: set dec options )
DUP LIT "l EQU ?exec-rm ( RM: reset mode )
( TODO: ?-$n-l - DECRST: reset dec options )
DUP LIT "m EQU ?exec-sgr ( SGR: set graphical rendering )
DUP LIT "n EQU ?exec-dsr ( DSR: device status reports )
( TODO: ?-$n-n - dec device status )
( TODO: $n-q - DECLL: load leds )
DUP LIT "r EQU ?exec-set-scrolling-region ( [$top;$bot] DECSTM: set scrolling reg )
DUP LIT "s EQU ?exec-scosc ( SCOSC: saved current cursor position )
DUP LIT "u EQU ?exec-scorc ( SCORC: restore saved cursor position )
( = 0 C - normal cursor ) ( = 0 C - normal cursor )
( = 1 C - bold cursor ) ( = 1 C - bold cursor )
debug-csi BRK debug-csi BRK
( TODO )
@exec-set-scrolling-region ( c^ -> BRK ) POP BRK @exec-set-scrolling-region ( c^ -> BRK ) POP BRK
@exec-tbc ( c^ -> BRK ) POP BRK @exec-tbc ( c^ -> BRK ) POP BRK
@ -950,18 +955,24 @@
@on-read-esc ( -> BRK ) @on-read-esc ( -> BRK )
.Console/r DEI .Console/r DEI
DUP debug-esc DUP debug-esc
DUP LIT "D EQU ?exec-ind &after
DUP LIT "E EQU ?exec-nel ( TODO: SP-F, SP-G, SP-L, SP-M, SP-N )
DUP LIT "H EQU ?exec-hts ( TODO: #-3, #-4, #-5, #-6, #-8 )
DUP LIT "M EQU ?exec-ri ( TODO: %-@, %-G )
DUP LIT "P EQU ?exec-dcs DUP LIT "D EQU ?exec-ind ( IND: index )
DUP LIT "[ EQU ?start-csi DUP LIT "E EQU ?exec-nel ( NEL: next line )
DUP LIT "] EQU ?start-osc DUP LIT "H EQU ?exec-hts ( HTS: tab set )
DUP LIT "c EQU ?exec-ris DUP LIT "M EQU ?exec-ri ( RI: reverse index )
DUP LIT "P EQU ?exec-dcs ( DCS: device control string )
DUP LIT "[ EQU ?start-csi ( CSI: control sequence introducer )
DUP LIT "] EQU ?start-osc ( OSC: operating system command )
DUP LIT "c EQU ?exec-ris ( RIS: full reset )
DUP LIT "( EQU ?start-charset DUP LIT "( EQU ?start-charset
DUP LIT ") EQU ?start-charset DUP LIT ") EQU ?start-charset
DUP LIT "7 EQU ?&skip ( save cursor ) DUP LIT "7 EQU ?&skip ( DECSC: save cursor )
DUP LIT "8 EQU ?&skip ( restore cursor ) DUP LIT "8 EQU ?&skip ( DECRC: restore cursor )
DUP LIT "> EQU ?&skip ( DECKPNM: normal keypad )
DUP LIT "~ EQU ?&skip ( LS1R: invoke G1 charset as GR )
debug-esc debug-esc
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
!on-read !on-read
@ -981,10 +992,10 @@
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
BRK BRK
( '(' = designate G0 charset ) ( preceeded by '(' [G0] or ')' [G1] )
( ')' = designate G1 charset ) ( "A" -> UK )
( '*' = designate G2 charset ) ( "B" -> USASCII )
( '+' = designate G3 charset ) ( "0" -> DEC special character, line drawing )
@start-charset ( c^ -> BRK ) @start-charset ( c^ -> BRK )
POP ;on-read-skip .Console/vect DEO2 BRK POP ;on-read-skip .Console/vect DEO2 BRK
@ -994,8 +1005,12 @@
@start-osc ( c^ -> BRK ) @start-osc ( c^ -> BRK )
POP reset-args ;on-read-osc .Console/vect DEO2 BRK POP reset-args ;on-read-osc .Console/vect DEO2 BRK
( TODO: 8-bit input not ready for prime time yet )
@on-read ( -> BRK ) @on-read ( -> BRK )
.Console/r DEI read BRK .Console/r DEI ( DUP #7f GTH ?read-8bit ) read BRK
@read-8bit ( c^ -> BRK )
DUP debug-esc #80 SUB !on-read-esc/after
@read ( c^ -> ) @read ( c^ -> )
DUP debug-read DUP debug-read
@ -1011,21 +1026,25 @@
clear-cursor !forward clear-cursor !forward
@read-ctrl ( c^ -> ) @read-ctrl ( c^ -> )
DUP #05 EQU ?&skip ( ENQ - return terminal status )
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 ( HT )
DUP #0a EQU ?read-lf DUP #0a EQU ?read-lf ( NL - LF )
DUP #0b EQU ?read-lf DUP #0b EQU ?read-lf ( VT - treated as LF )
DUP #0c EQU ?read-lf DUP #0c EQU ?read-lf ( FF - treated as LF )
DUP #0d EQU ?read-cr DUP #0d EQU ?read-cr ( CR )
( DUP #0e EQU ?&skip ( TODO: SO - shift out; G0 charset ) )
( DUP #0f EQU ?&skip ( TODO: SI - shift in; G1 charset ) )
DUP #1b EQU ?read-esc DUP #1b EQU ?read-esc
POP JMP2r &skip POP JMP2r
@read-bel ( 07 -> ) @read-bel ( 07 -> )
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 JMP2r &done JMP2r
( TODO: handle reverse wrap-around and dec auto-wrap )
@read-bs ( 08 -> ) @read-bs ( 08 -> )
POP clear-cursor #0001 !back-n POP clear-cursor #0001 !back-n
@ -1035,6 +1054,7 @@
@read-del ( 7f -> ) @read-del ( 7f -> )
POP JMP2r POP JMP2r
( TODO: respect tab stops )
@read-tab ( 09 -> ) @read-tab ( 09 -> )
POP POP
.cur-x LDZ2 ( x* ) .cur-x LDZ2 ( x* )