From 11897528f3ff66a947ab1b766b2b2037eb488c3a Mon Sep 17 00:00:00 2001 From: d6 Date: Mon, 23 Jan 2023 23:16:46 -0500 Subject: [PATCH] more improvements --- term.py | 6 ++---- term.tal | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/term.py b/term.py index 9ab225d..1f66917 100755 --- a/term.py +++ b/term.py @@ -24,14 +24,12 @@ def main(): pid, fd = pty.fork() if pid == 0: - # set TERM to something we can handle + # set TERM to something we can (mostly) handle env = dict(os.environ) - #env['TERM'] = 'dumb' env['TERM'] = 'ansi' os.execvpe('bash', ['bash'], env) else: # set the terminal size - #cols, rows = 63, 32 cols, rows = 79, 40 size = struct.pack("HHHH", rows, cols, 8, 8) fcntl.ioctl(fd, termios.TIOCSWINSZ, size) @@ -39,7 +37,7 @@ def main(): # use fd for the terminals stdin/stdout os.dup2(fd, sys.stdin.fileno()) os.dup2(os.dup(fd), sys.stdout.fileno()) - os.execvp('uxnemu', ['uxnemu', rom]) + os.execvp('uxnemu', ['uxnemu', rom] + args[1:]) if __name__ == "__main__": main() diff --git a/term.tal b/term.tal index ba4e4ab..789e12d 100644 --- a/term.tal +++ b/term.tal @@ -1,3 +1,9 @@ +( TODO: ) +( 1. investigate femto/nano bugs ) +( 2. support attributes (inverse, bold, dim) ) +( 3. add more ansi control seqs ) +( 4. log ESC [ ? x ; ... $c ) + ( ANSI sequences ) ( ) ( set attributes: ESC [ x ; ... m -> 0:reset 1:bright 2:dim 7:reverse ) @@ -25,6 +31,7 @@ ( show cursor: ESC [ ? 25 h ) ( hide cursor: ESC [ ? 25 l ) ( various: ESC [ ? ... ) +( insert lines: ESC [ $n L ) |00 @System [ &vect $2 &pad $6 &r $2 &g $2 &b $2 ] |10 @Console [ &vect $2 &r $1 &pad $5 &w $1 ] @@ -224,14 +231,15 @@ DUP LIT "l EQU ;exec-noop JCN2 ( disable line wrap ) DUP LIT "m EQU ;exec-noop JCN2 ( set attr ) DUP LIT "n EQU ;exec-status JCN2 ( get status ) - DUP LIT "G EQU ;exec-move-col JCN2 ( move cursor to col ) - DUP LIT "H EQU ;exec-move JCN2 ( move cursor ) DUP LIT "A EQU ;exec-up JCN2 ( up ) DUP LIT "B EQU ;exec-down JCN2 ( down ) DUP LIT "C EQU ;exec-forward JCN2 ( forward ) DUP LIT "D EQU ;exec-back JCN2 ( back ) + DUP LIT "G EQU ;exec-move-col JCN2 ( move cursor to col ) + DUP LIT "H EQU ;exec-move JCN2 ( move cursor ) DUP LIT "J EQU ;exec-erase-screen JCN2 ( erase screen ) DUP LIT "K EQU ;exec-erase-line JCN2 ( erase line ) + DUP LIT "L EQU ;exec-insert-lines JCN2 ( insert blank lines ) POP BRK @exec-noop ( c^ -> ) @@ -312,6 +320,12 @@ #0001 ;read-arg-2 JSR2 #0001 SUB2 ( col ) ;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^ -> ) ;scratch STH2 LIT "1 STH2kr STA INC2r