more improvements

This commit is contained in:
~d6 2023-01-23 23:16:46 -05:00
parent ac10ee23ff
commit 11897528f3
2 changed files with 18 additions and 6 deletions

View File

@ -24,14 +24,12 @@ def main():
pid, fd = pty.fork() pid, fd = pty.fork()
if pid == 0: if pid == 0:
# set TERM to something we can handle # set TERM to something we can (mostly) handle
env = dict(os.environ) env = dict(os.environ)
#env['TERM'] = 'dumb'
env['TERM'] = 'ansi' env['TERM'] = 'ansi'
os.execvpe('bash', ['bash'], env) os.execvpe('bash', ['bash'], env)
else: else:
# set the terminal size # set the terminal size
#cols, rows = 63, 32
cols, rows = 79, 40 cols, rows = 79, 40
size = struct.pack("HHHH", rows, cols, 8, 8) size = struct.pack("HHHH", rows, cols, 8, 8)
fcntl.ioctl(fd, termios.TIOCSWINSZ, size) fcntl.ioctl(fd, termios.TIOCSWINSZ, size)
@ -39,7 +37,7 @@ def main():
# use fd for the terminals stdin/stdout # use fd for the terminals stdin/stdout
os.dup2(fd, sys.stdin.fileno()) os.dup2(fd, sys.stdin.fileno())
os.dup2(os.dup(fd), sys.stdout.fileno()) os.dup2(os.dup(fd), sys.stdout.fileno())
os.execvp('uxnemu', ['uxnemu', rom]) os.execvp('uxnemu', ['uxnemu', rom] + args[1:])
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -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 ) ( 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 )
@ -25,6 +31,7 @@
( show cursor: ESC [ ? 25 h ) ( show cursor: ESC [ ? 25 h )
( hide cursor: ESC [ ? 25 l ) ( hide cursor: ESC [ ? 25 l )
( various: ESC [ ? ... ) ( various: ESC [ ? ... )
( insert lines: ESC [ $n L )
|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 ]
@ -224,14 +231,15 @@
DUP LIT "l EQU ;exec-noop JCN2 ( disable line wrap ) DUP LIT "l EQU ;exec-noop JCN2 ( disable line wrap )
DUP LIT "m EQU ;exec-noop JCN2 ( set attr ) DUP LIT "m EQU ;exec-noop JCN2 ( set attr )
DUP LIT "n EQU ;exec-status JCN2 ( get status ) 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 "A EQU ;exec-up JCN2 ( up )
DUP LIT "B EQU ;exec-down JCN2 ( down ) DUP LIT "B EQU ;exec-down JCN2 ( down )
DUP LIT "C EQU ;exec-forward JCN2 ( forward ) DUP LIT "C EQU ;exec-forward JCN2 ( forward )
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 "H EQU ;exec-move JCN2 ( move cursor )
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 )
POP BRK POP BRK
@exec-noop ( c^ -> ) @exec-noop ( c^ -> )
@ -312,6 +320,12 @@
#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^ -> )
;scratch STH2 ;scratch STH2
LIT "1 STH2kr STA INC2r LIT "1 STH2kr STA INC2r