From 72b6ab4389cb39d4437b962f8d4aec2c76fbca6d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Sep 2022 11:26:16 -0400 Subject: [PATCH] Provide a route to operation that factors in addressing mode. --- InstructionSets/M68k/Instruction.cpp | 4 ++++ InstructionSets/M68k/Instruction.hpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/InstructionSets/M68k/Instruction.cpp b/InstructionSets/M68k/Instruction.cpp index 16420bb8d..e41d0b118 100644 --- a/InstructionSets/M68k/Instruction.cpp +++ b/InstructionSets/M68k/Instruction.cpp @@ -269,3 +269,7 @@ std::string Preinstruction::to_string(int opcode) const { return result; } + +const char *Preinstruction::operation_string() const { + return _to_string(operation, mode<0>() == AddressingMode::Quick); +} diff --git a/InstructionSets/M68k/Instruction.hpp b/InstructionSets/M68k/Instruction.hpp index f84c98666..de3871762 100644 --- a/InstructionSets/M68k/Instruction.hpp +++ b/InstructionSets/M68k/Instruction.hpp @@ -348,6 +348,12 @@ class Preinstruction { /// is supplied then any quick fields in this instruction will be decoded; /// otherwise they'll be printed as just 'Q'. std::string to_string(int opcode = -1) const; + + /// Produces a slightly-more-idiomatic version of the operation name than + /// a direct to_string(instruction.operation) would, given that this decoder + /// sometimes aliases operations, disambiguating based on addressing mode + /// (e.g. MOVEQ is MOVE.l with the Q addressing mode). + const char *operation_string() const; }; }