1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Fix Scc size, DBcc behaviour.

This commit is contained in:
Thomas Harte 2022-05-03 14:40:51 -04:00
parent 1b224c961e
commit d8b3748d24
4 changed files with 16 additions and 6 deletions

View File

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

View File

@ -302,7 +302,7 @@ template <
flow_controller.decline_branch();
} else {
// Take the branch.
flow_controller.add_pc(dest.l);
flow_controller.add_pc(int16_t(dest.l) - 2);
}
} else {
// This DBcc will be ignored as the condition is true.

View File

@ -152,6 +152,7 @@ constexpr DataSize size(Operation operation) {
case Operation::CMPb: case Operation::TSTb:
case Operation::Bccb: case Operation::BSRb:
case Operation::CLRb:
case Operation::Scc:
case Operation::NEGXb: case Operation::NEGb:
case Operation::ASLb: case Operation::ASRb:
case Operation::LSLb: case Operation::LSRb:
@ -175,7 +176,7 @@ constexpr DataSize size(Operation operation) {
case Operation::MOVEtoCCR:
case Operation::CMPw: case Operation::CMPAw:
case Operation::TSTw:
case Operation::DBcc: case Operation::Scc:
case Operation::DBcc:
case Operation::Bccw: case Operation::BSRw:
case Operation::CLRw:
case Operation::NEGXw: case Operation::NEGw:
@ -292,7 +293,6 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
//
case Operation::CMPb: case Operation::CMPw: case Operation::CMPl:
case Operation::CMPAw: case Operation::CMPAl:
case Operation::DBcc:
return FetchOp1 | FetchOp2;
//
@ -317,6 +317,12 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
case Operation::EORb: case Operation::EORw: case Operation::EORl:
return FetchOp1 | FetchOp2 | StoreOp2;
//
// Two-operand; read both, write source.
//
case Operation::DBcc:
return FetchOp1 | FetchOp2 | StoreOp1;
//
// Two-operand; read both, write both.
//

View File

@ -37,7 +37,7 @@
- (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"]];
// _testSet = [NSSet setWithArray:@[@"ADDQ 0048"]];
// _testSet = [NSSet setWithArray:@[@"ADDQ 00d0"]];
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
}