summaryrefslogtreecommitdiff
path: root/disasm.cpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-05-09 00:09:20 +0300
committerOxore <oxore@protonmail.com>2023-05-09 00:09:20 +0300
commit2f2c8dbc006ec03e9887ab7a91f7cf97bb6ce53d (patch)
tree11b32e6b75b9f162afa158b5edf6e9db82cbc242 /disasm.cpp
parentb43a6b815d27e5fd846b50634af7b4a99b57c9ac (diff)
Impl CMPM
Diffstat (limited to 'disasm.cpp')
-rw-r--r--disasm.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/disasm.cpp b/disasm.cpp
index b50cb5f..6752717 100644
--- a/disasm.cpp
+++ b/disasm.cpp
@@ -1681,10 +1681,26 @@ static void disasm_add_sub_cmp(
}
static void disasm_cmpm(
- DisasmNode &node, const uint16_t instr, const DataBuffer &code, const Settings &s)
+ DisasmNode &node, const uint16_t instr, const DataBuffer &, const Settings &)
{
- // TODO Implement
- return disasm_verbatim(node, instr, code, s);
+ const OpSize opsize = static_cast<OpSize>((instr >> 6) & 3);
+ // Must be already handled by parent call
+ assert(opsize != OpSize::kInvalid);
+ const int m = (instr >> 3) & 3;
+ assert(m == 1);
+ (void) m;
+ const int xn = instr & 7;
+ const int xi = (instr >> 9) & 7;
+ const auto src = AddrModeArg::AnAddrIncr(xn);
+ const auto dst = AddrModeArg::AnAddrIncr(xi);
+ char src_str[32]{};
+ char dst_str[32]{};
+ src.SNPrint(src_str, sizeof(src_str));
+ dst.SNPrint(dst_str, sizeof(dst_str));
+ const char suffix = suffix_from_opsize(opsize);
+ snprintf(node.mnemonic, kMnemonicBufferSize, "cmpm%c", suffix);
+ snprintf(node.arguments, kArgsBufferSize, "%s,%s", src_str, dst_str);
+ node.size = kInstructionSizeStepBytes + src.Size() + dst.Size();
}
static void disasm_eor(