1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-04 01:57:54 +00:00

Route MOVEM appropriately.

This commit is contained in:
Thomas Harte 2022-05-05 12:42:57 -04:00
parent 70cdc2ca9f
commit 9ab70b340c
4 changed files with 21 additions and 1 deletions

View File

@ -51,6 +51,7 @@ template <Model model, typename BusHandler> class Executor {
void link(uint32_t &address, uint32_t offset);
void unlink(uint32_t &address);
template <typename IntT> void movep(Preinstruction instruction, uint32_t source, uint32_t dest);
template <typename IntT> void movem(Preinstruction instruction, uint32_t source, uint32_t dest);
// TODO: ownership of this shouldn't be here.
struct Registers {

View File

@ -397,10 +397,10 @@ template <Model model, typename BusHandler>
template <typename IntT>
void Executor<model, BusHandler>::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<uint8_t>(address, uint8_t(reg >> 24));
address += 2;
@ -435,6 +435,16 @@ void Executor<model, BusHandler>::movep(Preinstruction instruction, uint32_t sou
}
}
template <Model model, typename BusHandler>
template <typename IntT>
void Executor<model, BusHandler>::movem(Preinstruction instruction, uint32_t source, uint32_t dest) {
if(instruction.mode<0>() == AddressingMode::DataRegisterDirect) {
// Move registers to memory.
} else {
// Move memory to registers.
}
}
}
}

View File

@ -1184,6 +1184,14 @@ template <
flow_controller.template movep<uint16_t>(instruction, src.l, dest.l);
break;
case Operation::MOVEMl:
flow_controller.template movem<uint32_t>(instruction, src.l, dest.l);
break;
case Operation::MOVEMw:
flow_controller.template movem<uint16_t>(instruction, src.l, dest.l);
break;
/*
RTE and RTR share an implementation.
*/

View File

@ -265,6 +265,7 @@ template <Model model, Operation t_operation = Operation::Undefined> 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;
//