diff --git a/cli/hx/build.sh b/cli/hx/build.sh index 4562e87..a144b60 100755 --- a/cli/hx/build.sh +++ b/cli/hx/build.sh @@ -1,11 +1,11 @@ #!/bin/sh -e +ID="hx" ASM="uxncli $HOME/roms/drifblim.rom" EMU="uxncli" LIN="uxncli $HOME/roms/uxnlin.rom" - -SRC="hx.tal" -DST="hx.rom" +SRC="${ID}.tal" +DST="${ID}.rom" CPY="$HOME/roms" ARG="test.txt" diff --git a/cli/hx/hx.tal b/cli/hx/hx.tal index e0ca039..7f9f876 100644 --- a/cli/hx/hx.tal +++ b/cli/hx/hx.tal @@ -1,6 +1,6 @@ ( uxncli hx.rom file.bin ) -|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 +|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |0000 @@ -9,6 +9,14 @@ |0100 ( -> ) + .Console/type DEI ?&on-arg + ;Dict/usage perr + #010f DEO + +BRK + +&on-arg ( -> ) + ;await-src .Console/vector DEO2 BRK @@ -22,28 +30,50 @@ BRK @on-ready ( -> ) ;src .File/name DEO2 - #0002 .File/length DEO2 - LIT2r 0000 + #0001 .File/length DEO2 + #00 &stream - #0000 ,&buf STR2 - ;&buf .File/read DEO2 + ;&b .File/read DEO2 .File/success DEI2 #0000 EQU2 ?&eof - ;&buf LDA2 phex #2018 DEO - INC2r - ( linebreak ) - STH2kr #000f AND2 ORA ?&no-lb - #0a18 DEO &no-lb + [ LIT &b $1 ] phex/b + INC DUP print-spacer !&stream &eof - POP2r + POP #0a18 DEO - #010f DEO + #800f DEO BRK - &buf $2 -@skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r -@scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r -@sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r -@pstr ( str* -- ) &w LDAk #18 DEO INC2 LDAk ?&w POP2 JMP2r -@phex ( short* -- ) SWP phex/b &b DUP #04 SFT phex/c &c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r +@print-spacer ( id -- ) + DUP #0f AND ?&no-lb + POP #0a18 DEO JMP2r + &no-lb + #01 AND ?&end + #2018 DEO + &end +JMP2r + +( +@|stdlib ) + +@skey ( key buf -- proc ) + OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r + &eval POP2 #01 JMP2r +@scap ( str* -- end* ) + LDAk ?&w JMP2r + &w INC2 LDAk ?&w JMP2r +@sput ( chr str* -- ) + scap INC2k #00 ROT ROT STA STA JMP2r +@phex ( short* -- ) + SWP phex/b + &b DUP #04 SFT phex/c + &c #0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD #18 DEO JMP2r +@perr ( err* -- ) + &w LDAk #19 DEO INC2 LDAk ?&w POP2 JMP2r + +( +@|res ) + +@Dict + &usage "usage: 20 "hx.rom 20 "input.bin 0a $1