1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Fix LINK A7.

This commit is contained in:
Thomas Harte 2022-05-07 08:15:26 -04:00
parent 1defeca1ad
commit 2b3900fd14
5 changed files with 9 additions and 7 deletions

View File

@ -48,7 +48,7 @@ template <Model model, typename BusHandler> class Executor {
void bsr(uint32_t offset);
void jsr(uint32_t offset);
void link(uint32_t &address, uint32_t offset);
void link(Preinstruction instruction, uint32_t offset);
void unlink(uint32_t &address);
template <typename IntT> void movep(Preinstruction instruction, uint32_t source, uint32_t dest);
template <typename IntT> void movem_toM(Preinstruction instruction, uint32_t source, uint32_t dest);

View File

@ -381,10 +381,12 @@ void Executor<model, BusHandler>::jsr(uint32_t address) {
}
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::link(uint32_t &address, uint32_t offset) {
void Executor<model, BusHandler>::link(Preinstruction instruction, uint32_t offset) {
const auto reg = 8 + instruction.reg<0>();
sp().l -= 4;
bus_handler_.template write<uint32_t>(sp().l, address);
address = sp().l;
bus_handler_.template write<uint32_t>(sp().l, registers_[reg].l);
registers_[reg] = sp();
sp().l += offset;
}

View File

@ -781,7 +781,7 @@ template <
*/
case Operation::LINKw:
flow_controller.link(src.l, int16_t(dest.w));
flow_controller.link(instruction, int16_t(dest.w));
break;
case Operation::UNLINK:

View File

@ -331,6 +331,7 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
case Operation::CMPAw: case Operation::CMPAl:
case Operation::CHK:
case Operation::BTST:
case Operation::LINKw:
return FetchOp1 | FetchOp2;
//
@ -371,7 +372,6 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
// Two-operand; read both, write source.
//
case Operation::DBcc:
case Operation::LINKw:
return FetchOp1 | FetchOp2 | StoreOp1;
//

View File

@ -83,7 +83,7 @@
- (void)setUp {
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
// _fileSet = [NSSet setWithArray:@[@"rts.json", @"rtr.json"]];
// _fileSet = [NSSet setWithArray:@[@"link_unlk.json"]];
// _testSet = [NSSet setWithArray:@[@"NEGX 00c0"]];
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];