mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-27 22:30:49 +00:00
Disallow four illegal NBCD addressing modes.
This commit is contained in:
parent
19f7335926
commit
5de8fb0d08
@ -92,8 +92,26 @@ constexpr Operation Predecoder<model>::operation(OpT op) {
|
||||
}
|
||||
|
||||
template <Model model>
|
||||
template <uint8_t operation, bool validate> Preinstruction Predecoder<model>::validated(Preinstruction original) {
|
||||
return original;
|
||||
template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated(Preinstruction original) {
|
||||
if constexpr (!validate) {
|
||||
return original;
|
||||
}
|
||||
|
||||
switch(op) {
|
||||
default: return original;
|
||||
|
||||
// NBCD: don't permit address registers
|
||||
case OpT(Operation::NBCD):
|
||||
switch(original.mode<0>()) {
|
||||
default: return original;
|
||||
|
||||
case AddressingMode::AddressRegisterDirect:
|
||||
case AddressingMode::ProgramCounterIndirectWithDisplacement:
|
||||
case AddressingMode::ProgramCounterIndirectWithIndex8bitDisplacement:
|
||||
case AddressingMode::ImmediateData:
|
||||
return Preinstruction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Decodes the fields within an instruction and constructs a `Preinstruction`, given that the operation has already been
|
||||
|
@ -86,7 +86,7 @@ template <int index> NSString *operand(Preinstruction instruction) {
|
||||
case Operation::ABCD: instruction = @"ABCD"; break;
|
||||
case Operation::SBCD: instruction = @"SBCD"; break;
|
||||
case Operation::NBCD: instruction = @"NBCD"; break;
|
||||
case Operation::ADDb: instruction = @"ADD.b"; break;
|
||||
// case Operation::ADDb: instruction = @"ADD.b"; break;
|
||||
|
||||
// For now, skip any unmapped operations.
|
||||
default: continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user