more improvements

This commit is contained in:
~d6 2023-01-30 10:59:52 -05:00
parent 12a484c10c
commit b972b54f58
1 changed files with 55 additions and 36 deletions

View File

@ -32,19 +32,20 @@
( erase from current line to top: ESC [ 1 J ) ( erase from current line to top: ESC [ 1 J )
( erase screen: ESC [ 2 J ) ( erase screen: ESC [ 2 J )
( ) ( )
( insert lines: ESC [ $n L )
( delete n characters: ESC [ $n P )
( insert n blank characters: ESC [ $n @ )
( )
( NOT SUPPORTED YET: ) ( NOT SUPPORTED YET: )
( show cursor: ESC [ ? 25 h ) ( show cursor: ESC [ ? 25 h )
( hide cursor: ESC [ ? 25 l ) ( hide cursor: ESC [ ? 25 l )
( insert lines: ESC [ $n L ) ( ??? ESC lpar )
( ESC lpar ) ( ??? ESC 7 )
( 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 )
( end alt charset ESC [ 10 m ) ( end alt charset ESC [ 10 m )
( end alt charset ESC [ 11 m ) ( end alt charset ESC [ 11 m )
( delete n characters: ESC [ n P ) ( cursor forward n tab stops ESC [ $n I )
( insert n blank characters: ESC [ n @ )
|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 ]
@ -116,7 +117,7 @@
;on-read .Console/vect DEO2 ( set up stdin ) ;on-read .Console/vect DEO2 ( set up stdin )
( set to 01 to enable debug log ) ( set to 01 to enable debug log )
#00 .debug STZ #01 .debug STZ
.debug LDZ ,&continue JCN BRK &continue .debug LDZ ,&continue JCN BRK &continue
#99 #010e DEO #99 #010e DEO
@ -326,7 +327,7 @@
@end-arg ( c^ -> ) @end-arg ( c^ -> )
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
DUP ,debug-csi JSR ( DUP ,debug-csi JSR )
DUP LIT "d EQU ;exec-move-row JCN2 ( move cursor to row ) DUP LIT "d EQU ;exec-move-row JCN2 ( move cursor to row )
DUP LIT "h EQU ;exec-set-mode JCN2 ( enable line wrap ) DUP LIT "h EQU ;exec-set-mode JCN2 ( enable line wrap )
DUP LIT "l EQU ;exec-reset-mode JCN2 ( disable line wrap ) DUP LIT "l EQU ;exec-reset-mode JCN2 ( disable line wrap )
@ -339,12 +340,14 @@
DUP LIT "D EQU ;exec-back JCN2 ( back ) DUP LIT "D EQU ;exec-back JCN2 ( back )
DUP LIT "G EQU ;exec-move-col JCN2 ( move cursor to col ) DUP LIT "G EQU ;exec-move-col JCN2 ( move cursor to col )
DUP LIT "H EQU ;exec-move JCN2 ( move cursor ) DUP LIT "H EQU ;exec-move JCN2 ( move cursor )
DUP LIT "I EQU ;exec-forward-tabs JCN2 ( forward by tab stops )
DUP LIT "J EQU ;exec-erase-screen JCN2 ( erase screen ) DUP LIT "J EQU ;exec-erase-screen JCN2 ( erase screen )
DUP LIT "K EQU ;exec-erase-line JCN2 ( erase line ) DUP LIT "K EQU ;exec-erase-line JCN2 ( erase line )
DUP LIT "L EQU ;exec-insert-lines JCN2 ( insert blank lines ) DUP LIT "L EQU ;exec-insert-lines JCN2 ( insert blank lines )
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 )
POP BRK ;debug-csi JSR2 BRK
( POP BRK )
@exec-noop ( c^ -> ) @exec-noop ( c^ -> )
POP BRK POP BRK
@ -408,6 +411,8 @@
@exec-insert-blanks POP ;insert-n-spaces ;exec1 JMP2 @exec-insert-blanks POP ;insert-n-spaces ;exec1 JMP2
@exec-delete-lines POP ;delete-n-lines ;exec1 JMP2 @exec-delete-lines POP ;delete-n-lines ;exec1 JMP2
@exec-delete-chars POP ;delete-n-chars ;exec1 JMP2 @exec-delete-chars POP ;delete-n-chars ;exec1 JMP2
@exec-insert-lines POP ;insert-n-lines ;exec1 JMP2
@exec-forward-tabs POP ;forward-n-tabs ;exec1 JMP2
@exec-erase-line @exec-erase-line
POP #0000 ;read-arg-1 JSR2 POP #0000 ;read-arg-1 JSR2
@ -466,12 +471,6 @@
#0001 ;read-arg-2 JSR2 #0001 SUB2 ( col ) #0001 ;read-arg-2 JSR2 #0001 SUB2 ( col )
;goto JSR2 BRK ;goto JSR2 BRK
@exec-insert-lines ( c^ -> )
POP
#0001 ;read-arg-1 JSR2 ( n )
POP2 ( TODO: shift ;screen from bol forward by n*cols bytes )
BRK
@debug-esc ( c^ -> ) @debug-esc ( c^ -> )
.debug LDZ ,&continue JCN POP JMP2r &continue .debug LDZ ,&continue JCN POP JMP2r &continue
;scratch STH2 ;scratch STH2
@ -608,6 +607,25 @@
&replace ( 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* )
#0008 .cur-x LDZ2 #0007 AND2 SUB2 ( i* 8-cur%8* )
ADD2 ;forward-n JMP2 ( )
@insert-n-lines ( n* -> )
.col-bytes LDZ2 MUL2 STH2 ( [i*] )
;bol-addr JSR2 ( bound* [i*] )
;limit-addr JSR2 STH2kr ( bound* limit* i* [i*] )
INC2 INC2 SUB2 ( bound* start=limit-i-2* [i*] )
&loop ( bound* pos* [i*] )
LDA2k OVR2 STH2kr ADD2 ( bound* pos* x* pos+i* [i*] )
STA2 ( bound* pos* [i*] ; pos+i<-x )
#4220 OVR2 STA2 ( bound* pos* [i*] ; pos<-4220 )
#0002 SUB2 ( bound* pos-2* [i*] )
GTH2k #00 EQU ,&loop JCN ( bound* pos-2* [i*] )
POP2 POP2 POP2r ( )
#01 .dirty? STZ JMP2r ( )
@insert-n-spaces ( n* -> ) @insert-n-spaces ( n* -> )
STH2 ( [n*] ) STH2 ( [n*] )
.irm LDZ #00 EQU ,&replace JCN ( [n*] ) .irm LDZ #00 EQU ,&replace JCN ( [n*] )
@ -645,9 +663,10 @@
( starts below current line ) ( starts below current line )
@delete-n-lines ( n* -> ) @delete-n-lines ( n* -> )
( ;limit-addr JSR2 ;eol-addr JSR2 ) .col-bytes LDZ2 MUL2 STH2 ( [n*] )
POP2 ;limit-addr JSR2 STH2kr SUB2 ( limit* [n*] )
JMP2r ;eol-addr JSR2 ( limit* start* [n*] )
,delete-n-chars/loop JMP
@scroll @scroll
;limit-addr JSR2 STH2 ;limit-addr JSR2 STH2