diff options
-rw-r--r-- | disasm.cpp | 19 | ||||
-rw-r--r-- | disasm.h | 1 | ||||
-rw-r--r-- | test.bash | 8 | ||||
-rw-r--r-- | test_random.bash | 8 |
4 files changed, 28 insertions, 8 deletions
@@ -796,10 +796,23 @@ static void chunk_mf000_v5000(DisasmNode& n, uint16_t instr, const DataBuffer &c return disasm_addq_subq(n, instr, c, s, opsize); } -static void disasm_moveq(DisasmNode& n, uint16_t i, const DataBuffer &c, const Settings &s) +static void disasm_moveq(DisasmNode& node, uint16_t instr, const DataBuffer &code, const Settings &s) { - // TODO - return disasm_verbatim(n, i, c, s); + if (instr & 0x100) { + // Does not exist + return disasm_verbatim(node, instr, code, s); + } + const int m = 0; + const int xn = (instr >> 9) & 7; + const auto dst = AddrModeArg::Fetch(node.offset + kInstructionSizeStepBytes, code, m, xn, 'w'); + assert(dst.mode == AddrMode::kDn); + char dst_str[32]{}; + dst.SNPrint(dst_str, sizeof(dst_str)); + snprintf(node.mnemonic, kMnemonicBufferSize, "moveq"); + const int8_t data = instr & 0xff; + snprintf(node.arguments, kArgsBufferSize, "#%d,%s", data, dst_str); + node.size = kInstructionSizeStepBytes + dst.Size(); + } static void chunk_mf000_v8000(DisasmNode& n, uint16_t i, const DataBuffer &c, const Settings &s) @@ -15,7 +15,6 @@ constexpr size_t kRefsCountPerBuffer = 10; constexpr size_t kMnemonicBufferSize = 8; constexpr size_t kArgsBufferSize = 80; -constexpr size_t kMarkBufferSize = 64; enum class ReferenceType { kUnknown = 0, @@ -62,6 +62,14 @@ run_test_iterative() { done } +# 70xx / 72xx/ 74xx / 76xx / 78xx / 7axx / 7cxx / 7exx +# +run_test_simple "moveq #0 to D0" "\x70\x00" +run_test_simple "moveq #1 to D2" "\x74\x01" +run_test_simple "moveq #127 to D7" "\x7e\x7f" +run_test_simple "moveq #-1 to D5" "\x7a\xff" +run_test_simple "moveq #-128 to D1" "\x72\x80" + # From random tests # run_test_simple "movel %pc@(-16,%a0:l),%a3@+ with nop" "\x26\xfb\x88\xf0\x4e\x71" diff --git a/test_random.bash b/test_random.bash index 07403fe..20de9cd 100644 --- a/test_random.bash +++ b/test_random.bash @@ -46,10 +46,10 @@ run_test_random() { fi } -for i in `seq 1 10`; do - run_test_random huge$i 1024 -done - for i in `seq 1 1000`; do run_test_random tiny$i 1 done + +for i in `seq 1 10`; do + run_test_random huge$i 1024 +done |