diff --git a/cli/checksum/build.sh b/cli/checksum/build.sh index 3c74857..7184cc4 100755 --- a/cli/checksum/build.sh +++ b/cli/checksum/build.sh @@ -1,32 +1,25 @@ #!/bin/sh -e +ID="checksum" ASM="uxncli $HOME/roms/drifblim.rom" EMU="uxncli" LIN="uxncli $HOME/roms/uxnlin.rom" - -SRC="checksum.tal" -DST="checksum.rom" - +SRC="${ID}.tal" +DST="${ID}.rom" CPY="$HOME/roms" ARG="test.txt" -echo ">> Cleaning" - if [[ "$*" == *"--lint"* ]] then - echo ">> Linting $SRC" $LIN $SRC fi -echo ">> Assembling $SRC" $ASM $SRC $DST if [[ "$*" == *"--save"* ]] then - echo ">> Saving $DST" cp $DST $CPY fi -echo ">> Running $DST" $EMU $DST $ARG diff --git a/cli/checksum/checksum.tal b/cli/checksum/checksum.tal index c454427..4926935 100644 --- a/cli/checksum/checksum.tal +++ b/cli/checksum/checksum.tal @@ -1,6 +1,6 @@ ( uxncli checksum.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 &w LDAk #19 DEO INC2 LDAk ?&w POP2 + #010f DEO + +BRK + +&on-arg ( -> ) + ;await-src .Console/vector DEO2 BRK @@ -22,8 +30,10 @@ BRK @on-ready ( -> ) - ;src hash plong #2018 DEO ;src pstr #0a18 DEO - #010f DEO + ;src + DUP2 hash plong #2018 DEO + pstr #0a18 DEO + #800f DEO BRK @@ -62,4 +72,6 @@ JMP2r &s SWP plong/b &b DUP #04 SFT plong/c &c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r +@dict + &usage "usage: 20 "checksum.rom 20 "input.bin 0a $1