fix more bugs

This commit is contained in:
~d6 2023-01-30 14:25:03 -05:00
parent b972b54f58
commit 8ee11ca971
1 changed files with 44 additions and 29 deletions

View File

@ -9,21 +9,22 @@
( ANSI sequences )
( )
( set attributes: ESC [ x ; ... m -> 0:reset 1:bright 2:dim 7:reverse )
( get cursor position: ESC [ 6 n -> ESC [ $row ; $col R )
( set insert: ESC [ 4 h )
( set replace (def): ESC [ 4 l )
( enable line wrap: ESC [ 7 h )
( disable line wrap: ESC [ 7 l )
( set attributes: ESC [ x ; ... m -> 0:reset 1:bright 2:dim 7:reverse )
( get cursor position: ESC [ 6 n -> ESC [ $row ; $col R )
( set insert: ESC [ 4 h )
( set replace (def): ESC [ 4 l )
( enable line wrap: ESC [ 7 h )
( disable line wrap: ESC [ 7 l )
( )
( move cursor home: ESC [ H )
( move cursor: ESC [ $row ; $col H )
( move to column: ESC [ $n G )
( move to row: ESC [ $n d )
( move up: ESC [ $n A )
( move down: ESC [ $n B )
( move forward: ESC [ $n C )
( move back: ESC [ $n D )
( move cursor home: ESC [ H )
( move cursor: ESC [ $row ; $col H )
( move to column: ESC [ $n G )
( move to row: ESC [ $n d )
( move up: ESC [ $n A )
( move down: ESC [ $n B )
( move forward: ESC [ $n C )
( move back: ESC [ $n D )
( move forward n tabs ESC [ $n I )
( )
( erase from cursor to end of line: ESC [ K )
( erase from start of line to cursor: ESC [ 1 K )
@ -36,16 +37,16 @@
( delete n characters: ESC [ $n P )
( insert n blank characters: ESC [ $n @ )
( )
( NOT SUPPORTED YET: )
( show cursor: ESC [ ? 25 h )
( hide cursor: ESC [ ? 25 l )
( ??? ESC lpar )
( ??? ESC 7 )
( set bracketed paste mode (xterm): ESC [ ? 2004 h )
( reset bracketed paste mode (xterm): ESC [ ? 2004 l )
( )
( NOT SUPPORTED YET: )
( ??? ESC lpar )
( ??? ESC 7 )
( end alt charset ESC [ 10 m )
( end alt charset ESC [ 11 m )
( cursor forward n tab stops ESC [ $n I )
|00 @System [ &vect $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &vect $2 &r $1 &pad $5 &w $1 ]
@ -70,6 +71,11 @@
( terminal settings )
@irm $1 ( 01: insert and move right, 00: replace and overwrite )
@awm $1 ( 01: wrap chars at margin, 00: overwrite at margin )
@tcem $1 ( 01: cursor is visible, 00: cursor is invisible )
@paste $1 ( 01: bracketed paste is on, 00: is off )
( TODO: detect when pasting text from varvara if possible )
( to send CSI 200 ~ on start of paste, and CSI 201 ~ at end of paste )
|0100
( 80 cols x 24 rows )
@ -105,8 +111,10 @@
;update-tint JSR2
( set initial modes )
#01 .irm STZ ( insert and move right )
#01 .awm STZ ( wrap at margin )
#01 .irm STZ ( insert and move right )
#01 .awm STZ ( wrap at margin )
#01 .tcem STZ ( show cursor )
#00 .paste STZ ( bracketed paste is off )
( clear screen for initial draw )
;clear-screen JSR2
@ -203,7 +211,9 @@
.cur-x LDZ2 #30 SFT2 .Screen/x DEO2
.cur-y LDZ2 #30 SFT2 .Screen/y DEO2
;cur-addr JSR2 LDA2
.tcem LDZ #00 EQU ,&skip JCN
SWP ;reverse-tint JSR2 SWP
&skip
;draw-cell JMP2
@on-button ( -> )
@ -258,11 +268,9 @@
;add-to-arg JMP2
@start-priv
;on-read-priv .Console/vect DEO2
BRK
POP ;on-read-priv .Console/vect DEO2 BRK
@on-read-csi ( -> )
( #010e DEO )
.Console/r DEI
DUP LIT "? EQU ;start-priv JCN2
DUP LIT "; EQU ;next-arg JCN2
@ -305,10 +313,19 @@
@end-arg-priv ( c^ -> )
;on-read .Console/vect DEO2
DUP LIT "h EQU ,exec-priv-set-or-unset JCN
DUP LIT "l EQU ,exec-priv-set-or-unset JCN
DUP ,debug-priv JSR
( TODO: handle these )
POP BRK
@exec-priv-set-or-unset ( c^ -> )
#0001 ;read-arg-1 JSR2 ( c^ n* )
DUP2 #0019 NEQ2 ,&!25 JCN POP2 .tcem ,&change JMP
&!25 DUP2 #07d4 NEQ2 ,&!2004 JCN POP2 .paste ,&change JMP
&!2004 POP2 ;debug-priv JSR2 BRK
&change SWP LIT "h EQU SWP STZ BRK ( h is set, l is unset )
@debug-csi ( c^ -> )
.debug LDZ ,&continue JCN POP JMP2r &continue
;reset-scratch JSR2
@ -347,7 +364,6 @@
DUP LIT "M EQU ;exec-delete-lines JCN2 ( delete n lines )
DUP LIT "P EQU ;exec-delete-chars JCN2 ( delete n chars )
;debug-csi JSR2 BRK
( POP BRK )
@exec-noop ( c^ -> )
POP BRK
@ -593,7 +609,7 @@
@down ( -> )
#0001 ,down-n JMP
@insert ( c^ -> )
( @insert ( c^ -> )
.attr LDZ SWP ,insert-cell JMP
@insert-cell ( cell* -> )
@ -605,7 +621,7 @@
INC2 LTH2k ,&loop JCN ( cell* last pos+1* )
POP2 POP2 ( cell* )
&replace ( cell* )
;cur-addr JSR2 STA2 JMP2r ( )
;cur-addr JSR2 STA2 JMP2r ( ) )
@forward-n-tabs ( n* -> )
#0001 SUB2 #0008 MUL2 ( i=(n-1)8* )
@ -644,9 +660,8 @@
&loop2 ( 4220 pos* [-i*] )
STA2k INC2 INC2 INC2r ( 4220 pos+2* [-i+1*] )
ORAkr STHr ,&loop2 JCN ( 4220 pos+2* [-i+1*] )
&done
POP2 POP2 POP2r ( )
#01 .dirty? STZ JMP2r ( )
POP2 POP2 POP2r ( )
#01 .dirty? STZ JMP2r ( )
( starts with cursor pos )
@delete-n-chars ( n* -> )