mirror of
https://github.com/TomHarte/CLK.git
synced 2025-07-19 04:24:19 +00:00
Clear up MOVEs, fail on MOVEAs.
This commit is contained in:
@@ -144,9 +144,10 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ADD.
|
// ADD.
|
||||||
case OpT(Operation::ADDb): case OpT(Operation::ADDw): case OpT(Operation::ADDl):
|
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::SUBb): case OpT(Operation::SUBw): case OpT(Operation::SUBl):
|
||||||
case OpT(Operation::MOVEb): case OpT(Operation::MOVEw): case OpT(Operation::MOVEl):
|
case OpT(Operation::MOVEb): case OpT(Operation::MOVEw): case OpT(Operation::MOVEl):
|
||||||
|
case OpT(Operation::MOVEAw): case OpT(Operation::MOVEAl):
|
||||||
switch(original.mode<0>()) {
|
switch(original.mode<0>()) {
|
||||||
default: break;
|
default: break;
|
||||||
case AddressingMode::AddressRegisterDirect:
|
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)) {
|
if constexpr (op != OpT(Operation::ADDb) && op != OpT(Operation::SUBb) && op != OpT(Operation::MOVEb)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case AddressingMode::None:
|
case AddressingMode::None:
|
||||||
return Preinstruction();
|
return Preinstruction();
|
||||||
}
|
}
|
||||||
@@ -162,6 +164,10 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
|
|||||||
default: return original;
|
default: return original;
|
||||||
|
|
||||||
case AddressingMode::AddressRegisterDirect:
|
case AddressingMode::AddressRegisterDirect:
|
||||||
|
if constexpr (op == OpT(Operation::MOVEAw) || op == OpT(Operation::MOVEAl)) {
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case AddressingMode::ImmediateData:
|
case AddressingMode::ImmediateData:
|
||||||
case AddressingMode::ProgramCounterIndirectWithDisplacement:
|
case AddressingMode::ProgramCounterIndirectWithDisplacement:
|
||||||
case AddressingMode::ProgramCounterIndirectWithIndex8bitDisplacement:
|
case AddressingMode::ProgramCounterIndirectWithIndex8bitDisplacement:
|
||||||
@@ -426,7 +432,8 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::decode(ui
|
|||||||
// b6–b8 and b9–b11: destination effective address;
|
// b6–b8 and b9–b11: destination effective address;
|
||||||
// [already decoded: b12–b13: size]
|
// [already decoded: b12–b13: 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>(
|
return validated<op, validate>(
|
||||||
Preinstruction(operation,
|
Preinstruction(operation,
|
||||||
combined_mode(ea_mode, ea_register), ea_register,
|
combined_mode(ea_mode, ea_register), ea_register,
|
||||||
@@ -706,7 +713,10 @@ Preinstruction Predecoder<model>::decode2(uint16_t instruction) {
|
|||||||
using Op = Operation;
|
using Op = Operation;
|
||||||
|
|
||||||
// 4-116 (p220)
|
// 4-116 (p220)
|
||||||
Decode(Op::MOVEl);
|
switch(instruction & 0x1c0) {
|
||||||
|
case 0x040: Decode(Op::MOVEAl);
|
||||||
|
default: Decode(Op::MOVEl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Model model>
|
template <Model model>
|
||||||
@@ -714,7 +724,11 @@ Preinstruction Predecoder<model>::decode3(uint16_t instruction) {
|
|||||||
using Op = Operation;
|
using Op = Operation;
|
||||||
|
|
||||||
// 4-116 (p220)
|
// 4-116 (p220)
|
||||||
Decode(Op::MOVEw);
|
switch(instruction & 0x1c0) {
|
||||||
|
case 0x040: Decode(Op::MOVEAw);
|
||||||
|
default: Decode(Op::MOVEw);
|
||||||
|
}
|
||||||
|
// Decode(Op::MOVEw);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Model model>
|
template <Model model>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -116,6 +116,9 @@ template <int index> NSString *operand(Preinstruction instruction) {
|
|||||||
case Operation::MOVEw: instruction = @"MOVE.w"; break;
|
case Operation::MOVEw: instruction = @"MOVE.w"; break;
|
||||||
case Operation::MOVEl: instruction = @"MOVE.l"; 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.
|
// For now, skip any unmapped operations.
|
||||||
default: continue;
|
default: continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user