1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-11-02 18:16:08 +00:00

Implement JSR.

This commit is contained in:
Thomas Harte
2025-10-22 17:37:01 -04:00
parent 02e74ca1f4
commit 2d114b6677

View File

@@ -579,7 +579,23 @@ void Processor<model, Traits>::run_for(const Cycles cycles) {
);
goto jammed;
// MARK: - Flow control (other than BRK).
case access_program(JSR):
++registers.pc.full;
access(BusOperation::Read, Stack(registers.s), throwaway);
access(BusOperation::Write, Stack(registers.dec_s()), registers.pc.halves.high);
access(BusOperation::Write, Stack(registers.dec_s()), registers.pc.halves.low);
check_interrupt();
access(BusOperation::Read, Literal(registers.pc.full), registers.pc.halves.high);
registers.pc.halves.low = Storage::operand_;
goto fetch_decode;
// MARK: - NMI/IRQ/Reset, and BRK.
case access_program(BRK):
++registers.pc.full;
access(BusOperation::Write, Stack(registers.dec_s()), registers.pc.halves.high);