summaryrefslogtreecommitdiff
path: root/test.bash
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-04-20 23:44:13 +0300
committerOxore <oxore@protonmail.com>2023-04-20 23:44:13 +0300
commit32e67b15a32560a63a0f83c2b9f28259c00a7df5 (patch)
treea754cb2b37ba813e5bf273c75933660925ff2eff /test.bash
parent4bf92c651d761eb9749f4ca6eae38f57cbe8ea75 (diff)
Fully implement JSR support
Diffstat (limited to 'test.bash')
-rw-r--r--test.bash72
1 files changed, 63 insertions, 9 deletions
diff --git a/test.bash b/test.bash
index 5f4176d..49a7a02 100644
--- a/test.bash
+++ b/test.bash
@@ -33,8 +33,9 @@ run_test() {
./cmake-build/m68k-disasm -t ${TRACE_FILE} -o ${file_asm} ${file_orig_bin}
${AS} -o ${file_as_o} ${file_asm}
${OBJCOPY} ${file_as_o} -O binary ${file_as_bin}
- if ! cmp ${file_orig_bin} ${file_as_bin}; then
- echo ""
+ if ! cmp ${file_orig_bin} ${file_as_bin} >/dev/null 2>&1; then
+ echo "FAIL"
+ cat ${file_asm}
echo ${file_orig_bin}
hexdump -Cv ${file_orig_bin} | head -n1
echo ${file_as_bin}
@@ -42,7 +43,7 @@ run_test() {
break;
else
echo "OK"
- cat ${file_asm}
+ #cat ${file_asm}
fi
done
}
@@ -57,11 +58,8 @@ jsr_m2() {
jsr_m5() {
# (4ea8..4eaf) xxxx
#
- # XXX this test fails with suffix "\x00\x00", because GNU AS makes
- # optimization and inserts jsr M2/"(An)" (0x4e90) version instead. Hence the
- # disassembler must generate ".short" alternative in such cases. But it may be
- # irrelevant in practice if this variant simply does not exist in the wild.
- #
+ # Zero value
+ run_test ${FUNCNAME} "\x4e" 0xa8 8 1 "\x00\x00"
# Positive value, all registers
run_test ${FUNCNAME} "\x4e" 0xa8 8 1 "\x00\x0a"
# Negative value
@@ -71,7 +69,7 @@ jsr_m5() {
jsr_m6() {
# (4eb0..4eb7) xxxx
#
- # Positive value, Arbitrary Xn register
+ # Positive value, Arbitrary An register
run_test ${FUNCNAME} "\x4e" 0xb0 8 1 "\x00\x0f"
# Negative value
run_test ${FUNCNAME} "\x4e" 0xb0 1 1 "\x00\xf0"
@@ -87,6 +85,62 @@ jsr_m6() {
run_test ${FUNCNAME} "\x4e\xb0" 0x00 8 0x10 "\x0f"
}
+jsr_m7_xn0() {
+ # 43b8 xxxx Word displacement
+ #
+ # Zero value
+ run_test ${FUNCNAME} "\x4e\xb8\x00" 0x00 1 1 ""
+ # Positive value
+ run_test ${FUNCNAME} "\x4e\xb8\x00" 0x1f 1 1 ""
+ # Negative value
+ run_test ${FUNCNAME} "\x4e\xb8" 0x8a 1 1 "\x0c"
+}
+
+jsr_m7_xn1() {
+ # 43b9 xxxx Long displacement
+ #
+ # Zero value
+ run_test ${FUNCNAME} "\x4e\xb9\x00\x00\x00" 0x00 1 1 ""
+ # Positive value
+ run_test ${FUNCNAME} "\x4e\xb9\x10\xbb\x43" 0x1f 1 1 ""
+ # Negative value
+ run_test ${FUNCNAME} "\x4e\xb9\x80\xcc\xd9" 0x8a 1 1 ""
+}
+
+jsr_m7_xn2() {
+ # 43ba xxxx
+ #
+ # Zero value
+ run_test ${FUNCNAME} "\x4e\xba\x00" 0x00 1 1 ""
+ # Positive value
+ run_test ${FUNCNAME} "\x4e\xba\x00" 0x1f 1 1 ""
+ # Negative value
+ run_test ${FUNCNAME} "\x4e\xba" 0x8a 1 1 "\x0c"
+}
+
+jsr_m7_xn3() {
+ # 43bb xxxx
+ #
+ # Positive value, Arbitrary Xn register
+ run_test ${FUNCNAME} "\x4e\xbb" 0x00 8 0x10 "\x1a"
+ # Negative value
+ run_test ${FUNCNAME} "\x4e" 0xbb 1 1 "\x00\xf0"
+ # Zero displacement
+ run_test ${FUNCNAME} "\x4e" 0xbb 1 1 "\x00\x00"
+ # Address register
+ run_test ${FUNCNAME} "\x4e" 0xbb 1 1 "\x80\x0a"
+ # Long displacement, positive
+ run_test ${FUNCNAME} "\x4e" 0xbb 1 1 "\x08\x0c"
+ # Long displacement, negative
+ run_test ${FUNCNAME} "\x4e" 0xbb 1 1 "\x08\xb0"
+ # Arbitrary Xn2
+ run_test ${FUNCNAME} "\x4e\xbb" 0x00 8 0x10 "\x0f"
+}
+
jsr_m2
jsr_m5
jsr_m6
+jsr_m7_xn0
+jsr_m7_xn1
+jsr_m7_xn2
+jsr_m7_xn3