diff options
author | Oxore <oxore@protonmail.com> | 2023-05-01 12:38:09 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2023-05-01 13:05:16 +0300 |
commit | 3a56a664e444a28acb96c1ad035654dc408fae72 (patch) | |
tree | 4166d97d72d7a24d14f0e89d6693ed7897791ed2 /test.bash | |
parent | 666b07b0d61d10834533fcbdd870080d9ad1948d (diff) |
Impl MOVE to/from CCR/SR
Diffstat (limited to 'test.bash')
-rw-r--r-- | test.bash | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -18,7 +18,7 @@ CRST="\033[39m" rm -rf ${TEST_DIR} mkdir -p ${TEST_DIR} -run_test_simple() { +run_test_expect_short() { local test_name=$1 local test_name_sanitized=${test_name//[^a-zA-Z0-9_\-]/-} local data=$2 @@ -27,29 +27,29 @@ run_test_simple() { local file_as_o=${TEST_DIR}/${test_name_sanitized}.as.o local file_as_elf=${TEST_DIR}/${test_name_sanitized}.as.elf local file_as_bin=${TEST_DIR}/${test_name_sanitized}.as.bin - echo -ne "Test \"${test_name}\"... " + echo -ne "Test expect .short \"${test_name}\"... " echo -ne "${data}" >${file_orig_bin} ${DISASM} -o ${file_asm} ${file_orig_bin} ${AS} -m68000 -o ${file_as_o} ${file_asm} ${LD} -o ${file_as_elf} ${file_as_o} ${OBJCOPY} ${file_as_elf} -O binary ${file_as_bin} - if ! cmp ${file_orig_bin} ${file_as_bin} >/dev/null 2>&1; then + if ! grep ".short" ${file_asm} >/dev/null 2>&1; then + echo -e "${CRED}FAIL${CRST}: NOT .short emitted, but .short EXPECTED" + cat ${file_asm} + elif ! cmp ${file_orig_bin} ${file_as_bin} >/dev/null 2>&1; then echo -e "${CRED}FAIL${CRST}: output and input binaries do not match" cat ${file_asm} echo ${file_orig_bin} hexdump -Cv ${file_orig_bin} | head -n1 echo ${file_as_bin} hexdump -Cv ${file_as_bin} | head -n1 - elif grep ".short" ${file_asm} >/dev/null 2>&1; then - echo -e "${CRED}FAIL${CRST}: .short emitted" - cat ${file_asm} else echo -e "${CGREEN}OK${CRST}" #cat ${file_asm} fi } -run_test_expect_short() { +run_test_simple() { local test_name=$1 local test_name_sanitized=${test_name//[^a-zA-Z0-9_\-]/-} local data=$2 @@ -58,22 +58,22 @@ run_test_expect_short() { local file_as_o=${TEST_DIR}/${test_name_sanitized}.as.o local file_as_elf=${TEST_DIR}/${test_name_sanitized}.as.elf local file_as_bin=${TEST_DIR}/${test_name_sanitized}.as.bin - echo -ne "Test expect .short \"${test_name}\"... " + echo -ne "Test \"${test_name}\"... " echo -ne "${data}" >${file_orig_bin} ${DISASM} -o ${file_asm} ${file_orig_bin} ${AS} -m68000 -o ${file_as_o} ${file_asm} ${LD} -o ${file_as_elf} ${file_as_o} ${OBJCOPY} ${file_as_elf} -O binary ${file_as_bin} - if ! grep ".short" ${file_asm} >/dev/null 2>&1; then - echo -e "${CRED}FAIL${CRST}: NOT .short emitted, but .short EXPECTED" - cat ${file_asm} - elif ! cmp ${file_orig_bin} ${file_as_bin} >/dev/null 2>&1; then + if ! cmp ${file_orig_bin} ${file_as_bin} >/dev/null 2>&1; then echo -e "${CRED}FAIL${CRST}: output and input binaries do not match" cat ${file_asm} echo ${file_orig_bin} hexdump -Cv ${file_orig_bin} | head -n1 echo ${file_as_bin} hexdump -Cv ${file_as_bin} | head -n1 + elif grep ".short" ${file_asm} >/dev/null 2>&1; then + echo -e "${CRED}FAIL${CRST}: .short emitted" + cat ${file_asm} else echo -e "${CGREEN}OK${CRST}" #cat ${file_asm} @@ -93,6 +93,12 @@ run_test_iterative() { done } +# 40c0..40ff +# +run_test_simple "move from SR" "\x40\xc1" +run_test_simple "move to CCR" "\x44\xc2" +run_test_simple "move to SR" "\x46\xc3" + # 70xx / 72xx/ 74xx / 76xx / 78xx / 7axx / 7cxx / 7exx # run_test_simple "moveq #0 to D0" "\x70\x00" @@ -177,7 +183,6 @@ run_test_simple "moveml (xxx).L to all registers" "\x4c\xf9\xff\xff\x00\x00\x7f\ # run_test_expect_short "movem truncated" "\x48\x92" - # 5x38 / 5x78 / 5xb8 (xxx).W # run_test_simple "addqb #8,offset:w" "\x50\x38\x00\x73" |