From 8b874f105d52a461942bbb8960d0f729c0865507 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sat, 22 Apr 2023 22:00:04 +0300 Subject: Split mnemonic and arguments formatting --- disasm.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'disasm.h') 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 #include -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); +}; -- cgit v1.2.3