From 9ab70b340cbb59536a5c39442e1eedd3f3e61d49 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 5 May 2022 12:42:57 -0400 Subject: [PATCH] Route MOVEM appropriately. --- InstructionSets/M68k/Executor.hpp | 1 + .../M68k/Implementation/ExecutorImplementation.hpp | 12 +++++++++++- .../M68k/Implementation/PerformImplementation.hpp | 8 ++++++++ InstructionSets/M68k/Instruction.hpp | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/InstructionSets/M68k/Executor.hpp b/InstructionSets/M68k/Executor.hpp index 60ce8e9a5..e3eeb7d58 100644 --- a/InstructionSets/M68k/Executor.hpp +++ b/InstructionSets/M68k/Executor.hpp @@ -51,6 +51,7 @@ template class Executor { void link(uint32_t &address, uint32_t offset); void unlink(uint32_t &address); template void movep(Preinstruction instruction, uint32_t source, uint32_t dest); + template void movem(Preinstruction instruction, uint32_t source, uint32_t dest); // TODO: ownership of this shouldn't be here. struct Registers { diff --git a/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp b/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp index 6dea4a815..e75748a32 100644 --- a/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp +++ b/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp @@ -397,10 +397,10 @@ template template void Executor::movep(Preinstruction instruction, uint32_t source, uint32_t dest) { if(instruction.mode<0>() == AddressingMode::DataRegisterDirect) { + // Move register to memory. const uint32_t reg = source; uint32_t address = dest; - // Move register to memory. if constexpr (sizeof(IntT) == 4) { bus_handler_.template write(address, uint8_t(reg >> 24)); address += 2; @@ -435,6 +435,16 @@ void Executor::movep(Preinstruction instruction, uint32_t sou } } +template +template +void Executor::movem(Preinstruction instruction, uint32_t source, uint32_t dest) { + if(instruction.mode<0>() == AddressingMode::DataRegisterDirect) { + // Move registers to memory. + } else { + // Move memory to registers. + } +} + } } diff --git a/InstructionSets/M68k/Implementation/PerformImplementation.hpp b/InstructionSets/M68k/Implementation/PerformImplementation.hpp index b4a435469..65a57f446 100644 --- a/InstructionSets/M68k/Implementation/PerformImplementation.hpp +++ b/InstructionSets/M68k/Implementation/PerformImplementation.hpp @@ -1184,6 +1184,14 @@ template < flow_controller.template movep(instruction, src.l, dest.l); break; + case Operation::MOVEMl: + flow_controller.template movem(instruction, src.l, dest.l); + break; + + case Operation::MOVEMw: + flow_controller.template movem(instruction, src.l, dest.l); + break; + /* RTE and RTR share an implementation. */ diff --git a/InstructionSets/M68k/Instruction.hpp b/InstructionSets/M68k/Instruction.hpp index 77fb18278..5d9b3a074 100644 --- a/InstructionSets/M68k/Instruction.hpp +++ b/InstructionSets/M68k/Instruction.hpp @@ -265,6 +265,7 @@ template uint8_t ope case Operation::PEA: case Operation::JMP: case Operation::JSR: case Operation::MOVEPw: case Operation::MOVEPl: + case Operation::MOVEMw: case Operation::MOVEMl: return 0; //