11 | 12 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,48 @@ |
1 |
+#!/bin/sh |
|
2 |
+set -e |
|
3 |
+cd "$(dirname "${0}")/.." |
|
4 |
+rm -rf asma-test |
|
5 |
+mkdir asma-test |
|
6 |
+cd asma-test |
|
7 |
+ |
|
8 |
+build_asma() { |
|
9 |
+ sed -ne '/^( devices )/,/^( vectors )/p' ../projects/software/asma.usm |
|
10 |
+ cat <<EOD |
|
11 |
+|0100 @reset |
|
12 |
+ ;&source-file ;&dest-file ;asma-assemble-file JSR2 |
|
13 |
+ ;asma/error LDA2 #0000 NEQ2 JMP BRK |
|
14 |
+ #0000 DIV |
|
15 |
+ |
|
16 |
+ &source-file "in.usm 00 |
|
17 |
+ &dest-file "out.rom 00 |
|
18 |
+ |
|
19 |
+EOD |
|
20 |
+ sed -ne '/%asma-IF-ERROR/,$p' ../projects/software/asma.usm |
|
21 |
+} |
|
22 |
+ |
|
23 |
+echo 'Assembling asma with uxnasm' |
|
24 |
+build_asma > asma.usm |
|
25 |
+../bin/uxnasm asma.usm asma.rom > uxnasm.log |
|
26 |
+find ../projects -type f -name '*.usm' -not -name 'blank.usm' | sort | while read F; do |
|
27 |
+ echo "Comparing assembly of ${F}" |
|
28 |
+ BN="$(basename "${F%.usm}")" |
|
29 |
+ |
|
30 |
+ if ! ../bin/uxnasm "${F}" "uxnasm-${BN}.rom" > uxnasm.log; then |
|
31 |
+ echo "error: uxnasm failed to assemble ${F}" |
|
32 |
+ tail uxnasm.log |
|
33 |
+ exit 1 |
|
34 |
+ fi |
|
35 |
+ xxd "uxnasm-${BN}.rom" > "uxnasm-${BN}.hex" |
|
36 |
+ |
|
37 |
+ cp "${F}" 'in.usm' |
|
38 |
+ if ! ../bin/debugger asma.rom > asma.log; then |
|
39 |
+ echo "error: asma failed to assemble ${F}, while uxnasm succeeded" |
|
40 |
+ tail asma.log |
|
41 |
+ exit 1 |
|
42 |
+ fi |
|
43 |
+ xxd 'out.rom' > "asma-${BN}.hex" |
|
44 |
+ |
|
45 |
+ diff -u "uxnasm-${BN}.hex" "asma-${BN}.hex" |
|
46 |
+done |
|
47 |
+echo 'All OK' |
|
48 |
+ |