summaryrefslogtreecommitdiff
path: root/disasm.h
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-04-22 22:00:04 +0300
committerOxore <oxore@protonmail.com>2023-04-22 22:00:04 +0300
commit8b874f105d52a461942bbb8960d0f729c0865507 (patch)
treef389ca81408e488c313dfb4b94858ba9e4ea7738 /disasm.h
parent0f95d73515e01fce82155f4f054df90f4dd1d048 (diff)
Split mnemonic and arguments formatting
Diffstat (limited to 'disasm.h')
-rw-r--r--disasm.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/disasm.h b/disasm.h
index c166099..a332cd9 100644
--- a/disasm.h
+++ b/disasm.h
@@ -1,21 +1,26 @@
#pragma once
#include "data_buffer.h"
+#include "common.h"
#include <cstddef>
#include <cstdint>
-size_t m68k_disasm(
- char *out,
- size_t out_sz,
- size_t *instr_sz,
- uint16_t instr,
- uint32_t offset,
- const DataBuffer &code);
+enum class TracedNodeType {
+ kInstruction,
+ kData,
+};
-size_t m68k_render_raw_data_comment(
- char *out,
- size_t out_sz,
- uint32_t offset,
- size_t instr_sz,
- const DataBuffer &code);
+constexpr size_t kMnemonicBufferSize{10};
+constexpr size_t kArgsBufferSize{50};
+
+struct DisasmNode {
+ TracedNodeType type{};
+ uint32_t offset{};
+ size_t size{kInstructionSizeStepBytes}; // Instruction size in bytes
+ bool has_branch_addr{};
+ uint32_t branch_addr{}; // Absolute address of where to branch to
+ char mnemonic[kMnemonicBufferSize]{}; // Mnemonic of the instruction at the current offset
+ char arguments[kArgsBufferSize]{}; // Formatted arguments of the instruction
+ void Disasm(const DataBuffer &code);
+};