diff --git a/InstructionSets/68k/Decoder.cpp b/InstructionSets/68k/Decoder.cpp index d4e037028..367848932 100644 --- a/InstructionSets/68k/Decoder.cpp +++ b/InstructionSets/68k/Decoder.cpp @@ -488,7 +488,8 @@ template Preinstruction Predecoder::validated operation, op1_mode, op1_reg, op2_mode, op2_reg, - requires_supervisor(operation)); + requires_supervisor(operation), + size(operation)); } const auto invalid = invalid_operands(); @@ -499,7 +500,8 @@ template Preinstruction Predecoder::validated operation, op1_mode, op1_reg, op2_mode, op2_reg, - requires_supervisor(operation)); + requires_supervisor(operation), + size(operation)); } /// Decodes the fields within an instruction and constructs a `Preinstruction`, given that the operation has already been diff --git a/InstructionSets/68k/Instruction.hpp b/InstructionSets/68k/Instruction.hpp index d200bf0ff..3ae2e7006 100644 --- a/InstructionSets/68k/Instruction.hpp +++ b/InstructionSets/68k/Instruction.hpp @@ -359,28 +359,30 @@ class Preinstruction { return operands_[index] >> 5; } + bool requires_supervisor() { + return flags_ & 0x80; + } + DataSize size() { + return DataSize(flags_ & 0x7f); + } + private: uint8_t operands_[2] = { uint8_t(AddressingMode::None), uint8_t(AddressingMode::None)}; + uint8_t flags_ = 0; public: Preinstruction( Operation operation, AddressingMode op1_mode, int op1_reg, AddressingMode op2_mode, int op2_reg, - [[maybe_unused]] bool is_supervisor = false) : operation(operation) + bool is_supervisor, + DataSize size) : operation(operation) { operands_[0] = uint8_t(op1_mode) | uint8_t(op1_reg << 5); operands_[1] = uint8_t(op2_mode) | uint8_t(op2_reg << 5); + flags_ = (is_supervisor ? 0x80 : 0x00) | uint8_t(size); } - Preinstruction(Operation operation, [[maybe_unused]] bool is_supervisor = false) : operation(operation) {} - - Preinstruction(Operation operation, AddressingMode op1_mode, int op1_reg, [[maybe_unused]] bool is_supervisor = false) : operation(operation) { - operands_[0] = uint8_t(op1_mode) | uint8_t(op1_reg << 5); - } - - // TODO: record is_supervisor. - Preinstruction() {} };