diff --git a/InstructionSets/M68k/Implementation/PerformImplementation.hpp b/InstructionSets/M68k/Implementation/PerformImplementation.hpp index 2dad77da5..c4f450c85 100644 --- a/InstructionSets/M68k/Implementation/PerformImplementation.hpp +++ b/InstructionSets/M68k/Implementation/PerformImplementation.hpp @@ -399,7 +399,7 @@ template < // JMP: copies EA(0) to the program counter. case Operation::JMP: - flow_controller.set_pc(flow_controller.effective_address(0)); + flow_controller.set_pc(src.l); break; /* @@ -438,7 +438,7 @@ template < break; case Operation::LEA: - dest.l = flow_controller.effective_address(0); + dest.l = src.l; break; // case Operation::PEA: diff --git a/InstructionSets/M68k/Sequence.cpp b/InstructionSets/M68k/Sequence.cpp index dc45925bd..07ec25bb4 100644 --- a/InstructionSets/M68k/Sequence.cpp +++ b/InstructionSets/M68k/Sequence.cpp @@ -11,14 +11,14 @@ using namespace InstructionSet::M68k; template struct Steps { - static constexpr uint16_t value = 0; + static constexpr uint32_t value = 0; }; template struct Steps { - static constexpr uint16_t value = uint16_t(F) | uint16_t(Steps::value << 3); + static constexpr uint32_t value = uint16_t(F) | uint16_t(Steps::value << 4); }; -template uint16_t Sequence::steps_for(Operation operation) { +template uint32_t Sequence::steps_for(Operation operation) { switch(operation) { // This handles a NOP, and not much else. default: return 0; @@ -28,6 +28,7 @@ template uint16_t Sequence::steps_for(Operation operation) { // case Operation::LEA: return Steps< + Step::CalcEA1, Step::Perform >::value; diff --git a/InstructionSets/M68k/Sequence.hpp b/InstructionSets/M68k/Sequence.hpp index 2e13afc8d..7c1c4a328 100644 --- a/InstructionSets/M68k/Sequence.hpp +++ b/InstructionSets/M68k/Sequence.hpp @@ -35,6 +35,12 @@ enum class Step { StoreOp1, /// Store the value of operand 2. StoreOp2, + /// Calculate effective address of operand 1. + CalcEA1, + /// Calculate effective address of operand 2. + CalcEA2, + + Max = CalcEA2 }; /// Indicates the abstract steps necessary to perform an operation, @@ -47,8 +53,9 @@ template class Sequence { /// if no further steps remain. This step is removed from the /// list of remaining steps. Step pop_front() { - const auto step = Step(steps_ & 7); - steps_ >>= 3; + static_assert(int(Step::Max) < 16); + const auto step = Step(steps_ & 15); + steps_ >>= 4; return step; } @@ -59,12 +66,12 @@ template class Sequence { } private: - uint16_t steps_ = 0; + uint32_t steps_ = 0; - uint16_t steps_for(Operation); + uint32_t steps_for(Operation); }; -static_assert(sizeof(Sequence) == sizeof(uint16_t)); +static_assert(sizeof(Sequence) == sizeof(uint32_t)); } }