1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Proceed to failing Bcc and flagging up my lack of an implementation for BSR.

This commit is contained in:
Thomas Harte 2022-05-03 14:45:49 -04:00
parent d8b3748d24
commit 90f0005cf2
3 changed files with 23 additions and 10 deletions

View File

@ -279,18 +279,28 @@ template <
// Special case: the condition code is 1, which is ordinarily false. In that case this
// is the trailing step of a BSR.
case Operation::Bccb:
case Operation::Bccw:
case Operation::Bccl: {
// Test the conditional, treating 'false' as true.
const bool should_branch = status.evaluate_condition(instruction.condition());
// Schedule something appropriate, by rewriting the program for this instruction temporarily.
if(should_branch) {
flow_controller.add_pc(src.l);
if(status.evaluate_condition(instruction.condition())) {
flow_controller.add_pc(int8_t(src.b) - 2);
} else {
flow_controller.decline_branch();
}
} break;
break;
case Operation::Bccw:
if(status.evaluate_condition(instruction.condition())) {
flow_controller.add_pc(int16_t(src.b) - 2);
} else {
flow_controller.decline_branch();
}
break;
case Operation::Bccl:
if(status.evaluate_condition(instruction.condition())) {
flow_controller.add_pc(src.l - 2);
} else {
flow_controller.decline_branch();
}
break;
case Operation::DBcc:
// Decide what sort of DBcc this is.

View File

@ -272,6 +272,7 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
case Operation::ORItoSR: case Operation::ORItoCCR:
case Operation::ANDItoSR: case Operation::ANDItoCCR:
case Operation::EORItoSR: case Operation::EORItoCCR:
case Operation::Bccb: case Operation::Bccw: case Operation::Bccl:
return FetchOp1;
//

View File

@ -33,10 +33,12 @@
// add_sub
// addi_subi_cmpi
// eor_and_or
// addq_subq
// addx_subx
- (void)setUp {
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
_fileSet = [NSSet setWithArray:@[@"addq_subq.json"]];
_fileSet = [NSSet setWithArray:@[@"bcc.json"]];
// _testSet = [NSSet setWithArray:@[@"ADDQ 00d0"]];
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];