1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Take a bash at LINK and UNLK.

This commit is contained in:
Thomas Harte 2022-05-04 08:26:11 -04:00
parent 7d10976e08
commit 5d1d94848c
3 changed files with 24 additions and 18 deletions

View File

@ -45,8 +45,11 @@ template <Model model, typename BusHandler> class Executor {
void add_pc(uint32_t);
void decline_branch() {}
void did_update_status();
void bsr(uint32_t offset);
void jsr(uint32_t offset);
void link(uint32_t &address, uint32_t offset);
void unlink(uint32_t &address);
// TODO: ownership of this shouldn't be here.
struct Registers {

View File

@ -378,6 +378,21 @@ void Executor<model, BusHandler>::jsr(uint32_t address) {
program_counter_.l = address;
}
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::link(uint32_t &address, uint32_t offset) {
address_[7].l -= 4;
bus_handler_.template write<uint32_t>(address_[7].l, address);
address = address_[7].l;
address_[7].l += offset;
}
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::unlink(uint32_t &address) {
address_[7].l = address;
address = bus_handler_.template read<uint32_t>(address_[7].l);
address_[7].l += 4;
}
}
}

View File

@ -805,25 +805,13 @@ template <
amount of stack space to be allocated or deallocated.
*/
// case Operation::LINK:
// // Make space for the new long-word value, and set up
// // the proper target address for the stack operations to follow.
// address_[7].l -= 4;
// effective_address_[1].l = address_[7].l;
//
// // The current value of the address register will be pushed.
// destination_bus_data_.l = src.l;
//
// // The address register will then contain the bottom of the stack,
// // and the stack pointer will be offset.
// src.l = address_[7].l;
// address_[7].l += u_extend16(prefetch_queue_.w);
// break;
case Operation::LINKw:
flow_controller.link(src.l, int16_t(dest.w));
break;
// case Operation::UNLINK:
// address_[7].l = effective_address_[1].l + 2;
// dest.l = destination_bus_data_.l;
// break;
case Operation::UNLINK:
flow_controller.unlink(src.l);
break;
/*
TAS: sets zero and negative depending on the current value of the destination,