mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-05 10:28:58 +00:00
Correct decoding of Bcc.b, satisfying Bcc and BSR tests.
This commit is contained in:
parent
5a87506f3d
commit
af973138df
@ -812,10 +812,15 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::decode(ui
|
|||||||
// No further operands decoded, but note that one is somewhere in the opcode.
|
// No further operands decoded, but note that one is somewhere in the opcode.
|
||||||
//
|
//
|
||||||
case OpT(Operation::TRAP):
|
case OpT(Operation::TRAP):
|
||||||
case OpT(Operation::Bccb):
|
|
||||||
case OpT(Operation::BSRb):
|
case OpT(Operation::BSRb):
|
||||||
return validated<op, validate>(AddressingMode::Quick);
|
return validated<op, validate>(AddressingMode::Quick);
|
||||||
|
|
||||||
|
case OpT(Operation::Bccb):
|
||||||
|
return validated<op, validate>(
|
||||||
|
AddressingMode::Quick, 0,
|
||||||
|
AddressingMode::None, 0,
|
||||||
|
Condition((instruction >> 8) & 0xf));
|
||||||
|
|
||||||
//
|
//
|
||||||
// MARK: LINKw
|
// MARK: LINKw
|
||||||
//
|
//
|
||||||
|
@ -45,6 +45,7 @@ template <Model model, typename BusHandler> class Executor {
|
|||||||
void add_pc(uint32_t);
|
void add_pc(uint32_t);
|
||||||
void decline_branch() {}
|
void decline_branch() {}
|
||||||
void did_update_status();
|
void did_update_status();
|
||||||
|
void bsr(uint32_t offset);
|
||||||
|
|
||||||
// TODO: ownership of this shouldn't be here.
|
// TODO: ownership of this shouldn't be here.
|
||||||
struct Registers {
|
struct Registers {
|
||||||
|
@ -364,6 +364,13 @@ void Executor<model, BusHandler>::add_pc(uint32_t offset) {
|
|||||||
program_counter_.l = instruction_address_ + offset;
|
program_counter_.l = instruction_address_ + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <Model model, typename BusHandler>
|
||||||
|
void Executor<model, BusHandler>::bsr(uint32_t offset) {
|
||||||
|
address_[7].l -= 4;
|
||||||
|
bus_handler_.template write<uint32_t>(address_[7].l, program_counter_.l);
|
||||||
|
program_counter_.l = instruction_address_ + offset;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,6 +302,16 @@ template <
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Operation::BSRb:
|
||||||
|
flow_controller.bsr(int8_t(src.b) + 2);
|
||||||
|
break;
|
||||||
|
case Operation::BSRw:
|
||||||
|
flow_controller.bsr(int16_t(src.w) + 2);
|
||||||
|
break;
|
||||||
|
case Operation::BSRl:
|
||||||
|
flow_controller.bsr(src.l + 2);
|
||||||
|
break;
|
||||||
|
|
||||||
case Operation::DBcc:
|
case Operation::DBcc:
|
||||||
// Decide what sort of DBcc this is.
|
// Decide what sort of DBcc this is.
|
||||||
if(!status.evaluate_condition(instruction.condition())) {
|
if(!status.evaluate_condition(instruction.condition())) {
|
||||||
|
@ -273,6 +273,7 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
|
|||||||
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:
|
case Operation::Bccb: case Operation::Bccw: case Operation::Bccl:
|
||||||
|
case Operation::BSRb: case Operation::BSRw: case Operation::BSRl:
|
||||||
return FetchOp1;
|
return FetchOp1;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -35,11 +35,12 @@
|
|||||||
// eor_and_or
|
// eor_and_or
|
||||||
// addq_subq
|
// addq_subq
|
||||||
// addx_subx
|
// addx_subx
|
||||||
|
// bcc
|
||||||
|
|
||||||
- (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:@[@"bcc.json"]];
|
_fileSet = [NSSet setWithArray:@[@"btst_bchg_bclr_bset.json"]];
|
||||||
// _testSet = [NSSet setWithArray:@[@"Bcc 6000 [0]"]];
|
// _testSet = [NSSet setWithArray:@[@"Bcc 6206"]];
|
||||||
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
|
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
|
||||||
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
|
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user