1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-15 14:27:29 +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 // Special case: the condition code is 1, which is ordinarily false. In that case this
// is the trailing step of a BSR. // is the trailing step of a BSR.
case Operation::Bccb: case Operation::Bccb:
case Operation::Bccw: if(status.evaluate_condition(instruction.condition())) {
case Operation::Bccl: { flow_controller.add_pc(int8_t(src.b) - 2);
// 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);
} else { } else {
flow_controller.decline_branch(); 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: case Operation::DBcc:
// Decide what sort of DBcc this is. // 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::ORItoSR: case Operation::ORItoCCR:
case Operation::ANDItoSR: case Operation::ANDItoCCR: case Operation::ANDItoSR: case Operation::ANDItoCCR:
case Operation::EORItoSR: case Operation::EORItoCCR: case Operation::EORItoSR: case Operation::EORItoCCR:
case Operation::Bccb: case Operation::Bccw: case Operation::Bccl:
return FetchOp1; return FetchOp1;
// //

View File

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