This commit is contained in:
Erik Osheim 2022-02-09 20:04:12 -05:00
parent 1c7ed060b8
commit 99e2ac5a1c
2 changed files with 67 additions and 59 deletions

View File

@ -2,27 +2,9 @@
( ) ( )
( requires terminal to be in raw mode ) ( requires terminal to be in raw mode )
( see femto launcher script for more details ) ( see femto launcher script for more details )
( )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
%dbg { #ff .System/debug DEO }
%emit { .Console/write DEO }
%sp { #2018 DEO }
%nl { #0a18 DEO }
%cr { #0d18 DEO }
%exit { #01 .System/halt DEO BRK }
%ansi { #1b18 DEO #5b18 DEO }
%PEN-COL { ;term/cols LDA2 #0002 SUB2 NIP }
%HEIGHT { ;term/rows LDA2 NIP }
%LAST-LINE { ;term/rows LDA2 #0001 SUB2 NIP }
%PEN-LINE { ;term/rows LDA2 #0002 SUB2 NIP }
( ANSI sequences ) ( ANSI sequences )
( )
( goto $row,$col ESC [ $row ; $col H ) ( goto $row,$col ESC [ $row ; $col H )
( goto home ESC [ H ) ( goto home ESC [ H )
( go up ESC [ A ) ( go up ESC [ A )
@ -54,13 +36,32 @@
( black, red, green, yellow, ) ( black, red, green, yellow, )
( blue, magenta, cyan, white ) ( blue, magenta, cyan, white )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
%dbg { #ff .System/debug DEO }
%emit { .Console/write DEO }
%sp { #2018 DEO }
%nl { #0a18 DEO }
%cr { #0d18 DEO }
%exit { #01 .System/halt DEO BRK }
%ansi { #1b18 DEO #5b18 DEO }
%PEN-COL { ;term/cols LDA2 #0002 SUB2 NIP }
%HEIGHT { ;term/rows LDA2 NIP }
%LAST-LINE { ;term/rows LDA2 #0001 SUB2 NIP }
%PEN-LINE { ;term/rows LDA2 #0002 SUB2 NIP }
|0100 |0100
;read-filename .Console/vector DEO2 ;read-filename .Console/vector DEO2
( ;demo-path ;open-file JSR2 ) ( ;demo-path ;open-file JSR2 )
( use this if hardcoding to 80x24 ) ( use this if hardcoding to 80x24 )
( ;setup-80x24 JSR2 ) ( ;setup-80x24 JSR2 )
( use this to detect terminal size ) ( use this to detect terminal size )
( ;setup-terminal-size JSR2 ) ( ;setup-terminal-size JSR2 )
@ -74,12 +75,12 @@
.File/success DEI2 #0000 GTH2 ,&ok JCN .File/success DEI2 #0000 GTH2 ,&ok JCN
;input-error ;println JSR2 nl exit ;input-error ;println JSR2 nl exit
&ok ( calculate buffer limit address using start + size )
( save how many bytes were read ) &ok .File/success DEI2 ;buffer/data ADD2 ;buffer/limit STA2
.File/success DEI2 ;buffer/data ADD2 ;buffer/limit STA2
JMP2r JMP2r
@setup-terminal-size @setup-terminal-size
( ;setup-80x24 JSR2 )
#fe #fe ;term-move-cursor JSR2 #fe #fe ;term-move-cursor JSR2
;term-get-cursor-position JSR2 ;term-get-cursor-position JSR2
;tmp/data ;tmp/pos STA2 ;tmp/data ;tmp/pos STA2
@ -132,7 +133,6 @@
#00 ;tmp/pos LDA2 STA ( null terminate str ) #00 ;tmp/pos LDA2 STA ( null terminate str )
;tmp/data ;tmp/pos STA2 ( reset pos ) ;tmp/data ;tmp/pos STA2 ( reset pos )
;tmp/data ;open-file JSR2 ( open file ) ;tmp/data ;open-file JSR2 ( open file )
( ;setup-80x24 JSR2 )
;setup-terminal-size JSR2 ;setup-terminal-size JSR2
BRK BRK
@ -244,16 +244,23 @@
;draw-all JSR2 ;draw-all JSR2
BRK BRK
( TODO: 8-bit meta/alt? ) ( TODO: M-v for page up and M-> for goto end )
( TODO: tab? ) ( M-f and M-b for next/previous word )
@on-key ( M-n and M-p for next/previous paragraph )
;saw-esc LDA ,&escaped JCN ,&unmodified JMP ( maybe M-% for search&replace )
&escaped @on-key-escaped
#00 ;saw-esc STA #00 ;saw-esc STA
.Console/read DEI LIT '< EQU ( M-< ) ;goto-start JCN2 .Console/read DEI LIT '< EQU ( M-< ) ;goto-start JCN2
.Console/read DEI LIT '> EQU ( M-> ) ;goto-end JCN2 .Console/read DEI LIT '> EQU ( M-> ) ;goto-end JCN2
BRK BRK
&unmodified
( TODO: C-g or C-h for help )
( TODO: C-s for search )
( TODO: C-v for page down )
( TODO: 8-bit meta/alt? )
( TODO: tab input? )
@on-key
;saw-esc LDA ;on-key-escaped JCN2
.Console/read DEI #01 EQU ( C-a ) ;bol JCN2 .Console/read DEI #01 EQU ( C-a ) ;bol JCN2
.Console/read DEI #02 EQU ( C-b ) ;back JCN2 .Console/read DEI #02 EQU ( C-b ) ;back JCN2
.Console/read DEI #04 EQU ( C-d ) ;delete JCN2 .Console/read DEI #04 EQU ( C-d ) ;delete JCN2

View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
for NAME in about.txt math32.tal test-math32.tal tester.py primes32.tal regex.tal repl-regex.tal test-regex.tal grep.tal femto.tal femto.txt femto rainbow.tal drums.tal drums2.tal bfloat16.tal fixed.tal; do for NAME in about.txt math32.tal test-math32.tal tester.py primes32.tal regex.tal repl-regex.tal test-regex.tal grep.tal femto.tal femto.txt femto rainbow.tal drums.tal drums2.tal bfloat16.tal fixed.tal; do
echo "-> $NAME"
cp $NAME /var/www/plastic-idolatry.com/html/erik/nxu cp $NAME /var/www/plastic-idolatry.com/html/erik/nxu
done done