1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Add tests for RTE, RTR, TRAP, TRAPV, CHK.

This commit is contained in:
Thomas Harte 2022-04-22 10:06:39 -04:00
parent 06fb502047
commit efeee5160e
3 changed files with 18 additions and 10 deletions

View File

@ -411,6 +411,7 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::validated
case OpT(Operation::DIVU): case OpT(Operation::DIVS):
case OpT(Operation::MULU): case OpT(Operation::MULS):
case OpT(Operation::CHK):
switch(original.mode<0>()) {
default: return original;

View File

@ -142,6 +142,7 @@ constexpr int8_t quick(uint16_t instruction) {
case Operation::Bccb:
case Operation::BSRb:
case Operation::MOVEq: return int8_t(instruction);
case Operation::TRAP: return int8_t(instruction & 15);
default: {
int8_t value = (instruction >> 9) & 7;
value |= (value - 1)&8;
@ -151,11 +152,15 @@ constexpr int8_t quick(uint16_t instruction) {
}
constexpr int8_t quick(Operation op, uint16_t instruction) {
if(op == Operation::MOVEq || op == Operation::Bccb || op == Operation::BSRb) {
return quick<Operation::MOVEq>(instruction);
} else {
// ADDw is arbitrary; anything other than MOVEq will do.
return quick<Operation::ADDw>(instruction);
switch(op) {
case Operation::MOVEq: return quick<Operation::MOVEq>(instruction);
case Operation::Bccb: return quick<Operation::Bccb>(instruction);
case Operation::BSRb: return quick<Operation::BSRb>(instruction);
case Operation::TRAP: return quick<Operation::TRAP>(instruction);
default:
// ADDw is arbitrary; anything other than those listed above will do.
return quick<Operation::ADDw>(instruction);
}
}

View File

@ -246,14 +246,16 @@ template <int index> NSString *operand(Preinstruction instruction, uint16_t opco
case Operation::DIVU: instruction = @"DIVU"; break;
case Operation::DIVS: instruction = @"DIVS"; break;
case Operation::RTE: instruction = @"RTE"; break;
case Operation::RTR: instruction = @"RTR"; break;
case Operation::TRAP: instruction = @"TRAP"; break;
case Operation::TRAPV: instruction = @"TRAPV"; break;
case Operation::CHK: instruction = @"CHK"; break;
/*
TODO:
RTE, RTR,
TRAP, TRAPV,
CHK,
EXG, SWAP,
TAS,