From d21c67f237d066682590063bc1ad4d5b8fe9c806 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 19 Apr 2022 16:49:26 -0400 Subject: [PATCH] Don't permit byte move from address register. --- InstructionSets/68k/Decoder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/InstructionSets/68k/Decoder.cpp b/InstructionSets/68k/Decoder.cpp index 7bbc1a333..e38d747c1 100644 --- a/InstructionSets/68k/Decoder.cpp +++ b/InstructionSets/68k/Decoder.cpp @@ -146,10 +146,12 @@ template Preinstruction Predecoder::validated // ADD. case OpT(Operation::ADDb): case OpT(Operation::ADDw): case OpT(Operation::ADDl): case OpT(Operation::SUBb): case OpT(Operation::SUBw): case OpT(Operation::SUBl): + case OpT(Operation::MOVEb): case OpT(Operation::MOVEw): case OpT(Operation::MOVEl): switch(original.mode<0>()) { default: break; case AddressingMode::AddressRegisterDirect: - if constexpr (op != OpT(Operation::ADDb) && op != OpT(Operation::SUBb)) { + // TODO: I'm going to need get-size-by-operation elsewhere; use that here when implemented. + if constexpr (op != OpT(Operation::ADDb) && op != OpT(Operation::SUBb) && op != OpT(Operation::MOVEb)) { break; } case AddressingMode::None: @@ -159,6 +161,7 @@ template Preinstruction Predecoder::validated switch(original.mode<1>()) { default: return original; + case AddressingMode::AddressRegisterDirect: case AddressingMode::ImmediateData: case AddressingMode::ProgramCounterIndirectWithDisplacement: case AddressingMode::ProgramCounterIndirectWithIndex8bitDisplacement: @@ -186,7 +189,6 @@ template Preinstruction Predecoder::validated } // MOVE. - case OpT(Operation::MOVEb): case OpT(Operation::MOVEw): case OpT(Operation::MOVEl): switch(original.mode<0>()) { default: break; case AddressingMode::None: @@ -428,7 +430,7 @@ template Preinstruction Predecoder::decode(ui return validated( Preinstruction(operation, combined_mode(ea_mode, ea_register), ea_register, - combined_mode(opmode, data_register), data_register)); + combined_mode(opmode, data_register), data_register)); // // MARK: RESET, NOP RTE, RTS, TRAPV, RTR