diff options
author | Oxore <oxore@protonmail.com> | 2024-04-30 00:00:58 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2024-11-21 00:18:24 +0300 |
commit | 85614fc367ba53d0d5ca48873337571fc7f4f5b7 (patch) | |
tree | be53e4f27e915a254f48c0b9f78ecbd91ec6ba76 /src/main.cpp | |
parent | 2294d3e82e986894c0645840d01ddd6b2cb08523 (diff) |
Some refactoring
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp index 802e87b..4e49fde 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -336,13 +336,16 @@ static bool EmitNodeDisassembly( } assert(node.op.opcode != OpCode::kNone); if (ShouldPrintAsRaw(node.op)) { - Op::Raw(GetU16BE(code.buffer + node.address)) - .FPrint(output, s.indent, s.imm_hex); + FPrintOp( + output, + Op::Raw(GetU16BE(code.buffer + node.address)), + s.indent, + s.imm_hex); uint32_t i = kInstructionSizeStepBytes; for (; i < node.size; i += kInstructionSizeStepBytes) { char arg_str[kArgsBufferSize]{}; const auto arg = Arg::Raw(GetU16BE(code.buffer + node.address + i)); - arg.SNPrint(arg_str, kArgsBufferSize); + SNPrintArg(arg_str, kArgsBufferSize, arg); fprintf(output, ", %s", arg_str); } } else { @@ -397,8 +400,9 @@ static bool EmitNodeDisassembly( snprintf(ref2_label, (sizeof ref2_label), "L%08x", ref2_addr); } } - node.op.FPrint( + FPrintOp( output, + node.op, s.indent, s.imm_hex, ref_kinds, @@ -415,7 +419,7 @@ static bool EmitNodeDisassembly( fprintf(output, " | XREF2 @%08x", ref2_addr); } } else { - node.op.FPrint(output, s.indent, s.imm_hex); + FPrintOp(output, node.op, s.indent, s.imm_hex); } } if (s.raw_data_comment && (traced || s.raw_data_comment_all)) { @@ -447,10 +451,8 @@ static void EmitNonCodeSymbols( } } -constexpr const char *kSplitMarkerx32 = +constexpr const char *kSplitMarker = "\n| ---------------- >8 split_marker %08" PRIx32 " 8< ----------------\n"; -constexpr const char *kSplitMarkerzx = - "\n| ---------------- >8 split_marker %08zx 8< ----------------\n"; static FILE *SplitIfRequired( const EmitContext &ctx, @@ -479,7 +481,7 @@ static FILE *SplitIfRequired( if (s.output_dir_path) { return OpenNewPartFile(s.output_dir_path, node.address); } else { - fprintf(ctx.output, kSplitMarkerx32, node.address); + fprintf(ctx.output, kSplitMarker, node.address); return ctx.output; } } @@ -493,7 +495,7 @@ static FILE *SplitIfRequired( if (s.output_dir_path) { return OpenNewPartFile(s.output_dir_path, node.address); } else { - fprintf(ctx.output, kSplitMarkerx32, node.address); + fprintf(ctx.output, kSplitMarker, node.address); return ctx.output; } } @@ -502,7 +504,7 @@ static FILE *SplitIfRequired( if (s.output_dir_path) { return OpenNewPartFile(s.output_dir_path, node.address); } else { - fprintf(ctx.output, kSplitMarkerx32, node.address); + fprintf(ctx.output, kSplitMarker, node.address); return ctx.output; } } @@ -591,7 +593,7 @@ static bool EmitDisassembly( fclose(ctx.output); ctx.output = output; } else { - fprintf(ctx.output, kSplitMarkerzx, kRomSizeBytes); + fprintf(ctx.output, kSplitMarker, kRomSizeBytes); } } EmitNonCodeSymbols(ctx.output, disasm_map, code, s); |