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