1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-30 22:29:56 +00:00

Add Move[to/from][SR/CCR/USP] tests, correct decodings.

This commit is contained in:
Thomas Harte 2022-04-20 07:59:13 -04:00
parent cc69d01bdc
commit fab064641f
2 changed files with 20 additions and 0 deletions

View File

@ -101,6 +101,8 @@ constexpr Operation Predecoder<model>::operation(OpT op) {
}
/// Provides a post-decoding validation step — primarily ensures that the prima facie addressing modes are supported by the operation.
// TODO: once complete and working, see how ugly it would be to incorpoate these tests into the main
// decoding switches.
template <Model model>
template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated(Preinstruction original) {
if constexpr (!validate) {
@ -112,6 +114,7 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
// NBCD.
case OpT(Operation::NBCD):
case OpT(Operation::MOVEfromSR):
switch(original.mode<0>()) {
default: return original;
@ -123,6 +126,16 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
return Preinstruction();
}
case OpT(Operation::MOVEtoCCR):
case OpT(Operation::MOVEtoSR):
switch(original.mode<0>()) {
default: return original;
case AddressingMode::AddressRegisterDirect:
case AddressingMode::None:
return Preinstruction();
}
// The various immediates.
// case EORIb: case EORIl: case EORIw:
// case ORIb: case ORIl: case ORIw:

View File

@ -120,6 +120,13 @@ template <int index> NSString *operand(Preinstruction instruction) {
case Operation::LEA: instruction = @"LEA"; break;
case Operation::PEA: instruction = @"PEA"; break;
case Operation::MOVEtoSR: instruction = @"MOVEtoSR"; break;
case Operation::MOVEfromSR: instruction = @"MOVEfromSR"; break;
case Operation::MOVEtoCCR: instruction = @"MOVEtoCCR"; break;
case Operation::MOVEtoUSP: instruction = @"MOVEtoUSP"; break;
case Operation::MOVEfromUSP: instruction = @"MOVEfromUSP"; break;
// For now, skip any unmapped operations.
default: continue;
}