| ... | ... |
@@ -5,24 +5,9 @@ rm -rf asma-test |
| 5 | 5 |
mkdir asma-test |
| 6 | 6 |
cd asma-test |
| 7 | 7 |
|
| 8 |
-build_asma() {
|
|
| 9 |
- sed -ne '/^( devices )/,/^( vectors )/p' ../projects/software/asma.tal |
|
| 10 |
- cat <<EOD |
|
| 11 |
-|0100 @reset |
|
| 12 |
- ;&source-file ;&dest-file ;asma-assemble-file JSR2 |
|
| 13 |
- #01 .System/halt DEO |
|
| 14 |
- BRK |
|
| 15 |
- |
|
| 16 |
- &source-file "asma-test/in.tal 00 |
|
| 17 |
- &dest-file "asma-test/out.rom 00 |
|
| 18 |
- |
|
| 19 |
-EOD |
|
| 20 |
- sed -ne '/%asma-IF-ERROR/,$p' ../projects/software/asma.tal |
|
| 21 |
-} |
|
| 22 |
- |
|
| 23 | 8 |
expect_failure() {
|
| 24 | 9 |
cat > 'in.tal' |
| 25 |
- ( cd .. && bin/uxncli asma-test/asma.rom ) > asma.log 2>/dev/null |
|
| 10 |
+ echo asma-test/in.tal | ( cd .. && bin/uxncli asma-test/asma.rom ) > out.rom 2> asma.log |
|
| 26 | 11 |
if ! grep -qF "${1}" asma.log; then
|
| 27 | 12 |
echo "error: asma didn't report error ${1} in faulty code"
|
| 28 | 13 |
xxd asma.log |
| ... | ... |
@@ -30,8 +15,7 @@ expect_failure() {
|
| 30 | 15 |
} |
| 31 | 16 |
|
| 32 | 17 |
echo 'Assembling asma with uxnasm' |
| 33 |
-build_asma > asma.tal |
|
| 34 |
-( cd .. && bin/uxnasm asma-test/asma.tal asma-test/asma.rom ) > uxnasm.log |
|
| 18 |
+( cd .. && bin/uxnasm projects/software/asma.tal asma-test/asma.rom ) > uxnasm.log |
|
| 35 | 19 |
for F in $(find ../projects -path ../projects/library -prune -false -or -type f -name '*.tal' -not -name 'blank.tal' | sort); do |
| 36 | 20 |
echo "Comparing assembly of ${F}"
|
| 37 | 21 |
BN="$(basename "${F%.tal}")"
|
| ... | ... |
@@ -45,8 +29,9 @@ for F in $(find ../projects -path ../projects/library -prune -false -or -type f |
| 45 | 29 |
|
| 46 | 30 |
cp "${F}" 'in.tal'
|
| 47 | 31 |
rm -f 'out.rom' |
| 48 |
- ( cd .. && bin/uxncli asma-test/asma.rom ) > asma.log |
|
| 49 |
- if [ ! -f 'out.rom' ]; then |
|
| 32 |
+ echo asma-test/in.tal | ( cd .. && bin/uxncli asma-test/asma.rom ) > out.rom 2> asma.log |
|
| 33 |
+ cat asma.log |
|
| 34 |
+ if ! grep -qF 'bytes of heap used' asma.log; then |
|
| 50 | 35 |
echo "error: asma failed to assemble ${F}, while uxnasm succeeded"
|
| 51 | 36 |
tail asma.log |
| 52 | 37 |
exit 1 |
| 194 | 193 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,48 @@ |
| 1 |
+( devices ) |
|
| 2 |
+ |
|
| 3 |
+|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ] |
|
| 4 |
+|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] |
|
| 5 |
+|a0 @File [ &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 ] |
|
| 6 |
+ |
|
| 7 |
+( vectors ) |
|
| 8 |
+ |
|
| 9 |
+|0100 @reset |
|
| 10 |
+ ( |
|
| 11 |
+ Set the log level for helping to debug stuff. |
|
| 12 |
+ Its value is the bitwise OR of all the following output types: |
|
| 13 |
+ #01 prints the number of lines in the source code, |
|
| 14 |
+ #04 dumps all defined labels at end, and |
|
| 15 |
+ #08 prints the heap usage. |
|
| 16 |
+ ) |
|
| 17 |
+ #09 ;asma/log-level STA |
|
| 18 |
+ |
|
| 19 |
+ ;asma-heap ;heap STA2 |
|
| 20 |
+ |
|
| 21 |
+ ;on-input .Console/vector DEO2 |
|
| 22 |
+ BRK |
|
| 23 |
+ |
|
| 24 |
+@on-input ( -> ) |
|
| 25 |
+ .Console/read DEI |
|
| 26 |
+ DUP #0a EQU ,&newline JCN |
|
| 27 |
+ ;append-heap-byte JSR2 |
|
| 28 |
+ BRK |
|
| 29 |
+ |
|
| 30 |
+ &newline ( 0a ) |
|
| 31 |
+ DUP EOR ( 00 ) |
|
| 32 |
+ ;append-heap-byte JSR2 ( ) |
|
| 33 |
+ |
|
| 34 |
+ ;asma-heap #0000 ;asma-assemble-file JSR2 |
|
| 35 |
+ #01 .System/halt DEO |
|
| 36 |
+ BRK |
|
| 37 |
+ |
|
| 38 |
+include projects/library/asma.tal |
|
| 39 |
+ |
|
| 40 |
+@asma-heap |
|
| 41 |
+|e000 &end |
|
| 42 |
+ |
|
| 43 |
+@asma-read-buffer |
|
| 44 |
+|f800 &end |
|
| 45 |
+ |
|
| 46 |
+@asma-write-buffer |
|
| 47 |
+|ffff &end |
|
| 48 |
+ |