1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-29 04:33:04 +00:00

Clear up MOVEs, fail on MOVEAs.

This commit is contained in:
Thomas Harte 2022-04-19 17:13:23 -04:00
parent d21c67f237
commit ef87d09cfa
3 changed files with 1799 additions and 1782 deletions

View File

@ -144,9 +144,10 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::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):
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):
case OpT(Operation::MOVEAw): case OpT(Operation::MOVEAl):
switch(original.mode<0>()) {
default: break;
case AddressingMode::AddressRegisterDirect:
@ -154,6 +155,7 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
if constexpr (op != OpT(Operation::ADDb) && op != OpT(Operation::SUBb) && op != OpT(Operation::MOVEb)) {
break;
}
[[fallthrough]];
case AddressingMode::None:
return Preinstruction();
}
@ -162,6 +164,10 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
default: return original;
case AddressingMode::AddressRegisterDirect:
if constexpr (op == OpT(Operation::MOVEAw) || op == OpT(Operation::MOVEAl)) {
return original;
}
[[fallthrough]];
case AddressingMode::ImmediateData:
case AddressingMode::ProgramCounterIndirectWithDisplacement:
case AddressingMode::ProgramCounterIndirectWithIndex8bitDisplacement:
@ -426,7 +432,8 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::decode(ui
// b6b8 and b9b11: destination effective address;
// [already decoded: b12b13: size]
//
case OpT(Operation::MOVEb): case OpT(Operation::MOVEl): case OpT(Operation::MOVEw):
case OpT(Operation::MOVEb): case OpT(Operation::MOVEl): case OpT(Operation::MOVEw):
case OpT(Operation::MOVEAl): case OpT(Operation::MOVEAw):
return validated<op, validate>(
Preinstruction(operation,
combined_mode(ea_mode, ea_register), ea_register,
@ -706,7 +713,10 @@ Preinstruction Predecoder<model>::decode2(uint16_t instruction) {
using Op = Operation;
// 4-116 (p220)
Decode(Op::MOVEl);
switch(instruction & 0x1c0) {
case 0x040: Decode(Op::MOVEAl);
default: Decode(Op::MOVEl);
}
}
template <Model model>
@ -714,7 +724,11 @@ Preinstruction Predecoder<model>::decode3(uint16_t instruction) {
using Op = Operation;
// 4-116 (p220)
Decode(Op::MOVEw);
switch(instruction & 0x1c0) {
case 0x040: Decode(Op::MOVEAw);
default: Decode(Op::MOVEw);
}
// Decode(Op::MOVEw);
}
template <Model model>

File diff suppressed because it is too large Load Diff

View File

@ -116,6 +116,9 @@ template <int index> NSString *operand(Preinstruction instruction) {
case Operation::MOVEw: instruction = @"MOVE.w"; break;
case Operation::MOVEl: instruction = @"MOVE.l"; break;
case Operation::MOVEAw: instruction = @"MOVEA.w"; break;
case Operation::MOVEAl: instruction = @"MOVEA.l"; break;
// For now, skip any unmapped operations.
default: continue;
}