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

Fix Bcc, making decision that add_pc is relative to start of instruction.

This commit is contained in:
Thomas Harte 2022-05-03 15:21:42 -04:00
parent 90f0005cf2
commit 5a87506f3d
3 changed files with 6 additions and 6 deletions

View File

@ -361,7 +361,7 @@ void Executor<model, BusHandler>::set_pc(uint32_t address) {
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::add_pc(uint32_t offset) {
program_counter_.l += offset;
program_counter_.l = instruction_address_ + offset;
}
}

View File

@ -280,7 +280,7 @@ template <
// is the trailing step of a BSR.
case Operation::Bccb:
if(status.evaluate_condition(instruction.condition())) {
flow_controller.add_pc(int8_t(src.b) - 2);
flow_controller.add_pc(int8_t(src.b) + 2);
} else {
flow_controller.decline_branch();
}
@ -288,7 +288,7 @@ template <
case Operation::Bccw:
if(status.evaluate_condition(instruction.condition())) {
flow_controller.add_pc(int16_t(src.b) - 2);
flow_controller.add_pc(int16_t(src.w) + 2);
} else {
flow_controller.decline_branch();
}
@ -296,7 +296,7 @@ template <
case Operation::Bccl:
if(status.evaluate_condition(instruction.condition())) {
flow_controller.add_pc(src.l - 2);
flow_controller.add_pc(src.l + 2);
} else {
flow_controller.decline_branch();
}
@ -312,7 +312,7 @@ template <
flow_controller.decline_branch();
} else {
// Take the branch.
flow_controller.add_pc(int16_t(dest.l) - 2);
flow_controller.add_pc(int16_t(dest.l) + 2);
}
} else {
// This DBcc will be ignored as the condition is true.

View File

@ -39,7 +39,7 @@
- (void)setUp {
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
_fileSet = [NSSet setWithArray:@[@"bcc.json"]];
// _testSet = [NSSet setWithArray:@[@"ADDQ 00d0"]];
// _testSet = [NSSet setWithArray:@[@"Bcc 6000 [0]"]];
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
}