summaryrefslogtreecommitdiff
path: root/src/m68k.h
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2024-04-30 00:00:58 +0300
committerOxore <oxore@protonmail.com>2024-11-21 00:18:24 +0300
commit85614fc367ba53d0d5ca48873337571fc7f4f5b7 (patch)
treebe53e4f27e915a254f48c0b9f78ecbd91ec6ba76 /src/m68k.h
parent2294d3e82e986894c0645840d01ddd6b2cb08523 (diff)
Some refactoring
Diffstat (limited to 'src/m68k.h')
-rw-r--r--src/m68k.h51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/m68k.h b/src/m68k.h
index 6db0ebc..b60fbe2 100644
--- a/src/m68k.h
+++ b/src/m68k.h
@@ -294,14 +294,6 @@ struct Arg {
a.uword = instr;
return a;
}
- int SNPrint(
- char *buf,
- size_t bufsz,
- bool imm_as_hex = false,
- RefKindMask ref_kinds = 0,
- const char *label = nullptr,
- uint32_t self_addr = 0,
- uint32_t ref_addr = 0) const;
};
struct Op {
@@ -323,16 +315,6 @@ struct Op {
{
return Op::Typical(OpCode::kRaw, OpSize::kNone, Arg::Raw(instr));
}
- int FPrint(
- FILE *,
- const char *indent,
- bool imm_as_hex,
- RefKindMask ref_kinds = 0,
- const char *ref1_label = nullptr,
- const char *ref2_label = nullptr,
- uint32_t self_addr = 0,
- uint32_t ref1_addr = 0,
- uint32_t ref2_addr = 0) const;
};
constexpr size_t kMnemonicBufferSize = 10;
@@ -342,3 +324,36 @@ static constexpr inline bool IsBRA(Op op)
{
return op.opcode == OpCode::kBcc && op.condition == Condition::kT;
}
+
+int SNPrintArg(
+ char *buf,
+ size_t bufsz,
+ const Arg &,
+ bool imm_as_hex = false,
+ RefKindMask ref_kinds = 0,
+ const char *label = nullptr,
+ uint32_t self_addr = 0,
+ uint32_t ref_addr = 0);
+
+/// Return value means nothing and should be ignored
+int FPrintOp(
+ FILE *,
+ const Op &op,
+ const char *const indent,
+ const bool imm_as_hex,
+ RefKindMask ref_kinds = 0,
+ const char *ref1_label = nullptr,
+ const char *ref2_label = nullptr,
+ uint32_t self_addr = 0,
+ uint32_t ref1_addr = 0,
+ uint32_t ref2_addr = 0);
+
+constexpr size_t BaseInstructionSize(OpCode opcode)
+{
+ switch (opcode) {
+ case OpCode::kMOVEM:
+ return 2 * kInstructionSizeStepBytes;
+ default: break;
+ }
+ return kInstructionSizeStepBytes;
+}