From 20e774be1ec08dc83bec72a396ca74f4b10e26dd Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 22 Apr 2019 21:11:49 -0400 Subject: [PATCH] Corrects return address of JSR (An). --- .../68000/Implementation/68000Implementation.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index 6cfa2b656..793c0a347 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -75,7 +75,7 @@ template void Processor: std::cerr << "68000 Abilities exhausted; can't manage instruction " << std::hex << decoded_instruction_ << " from " << (program_counter_.full - 4) << std::endl; return; } else { -// if(0x4f7a == program_counter_.full - 4)return; +// if(0x4f7a == program_counter_.full - 4) return; // std::cout << std::hex << (program_counter_.full - 4) << ": " << std::setw(4) << decoded_instruction_ << '\t'; } @@ -1152,11 +1152,19 @@ template void Processor: } } break; - case int(MicroOp::Action::PrepareJSR): + case int(MicroOp::Action::PrepareJSR): { + const auto mode = (decoded_instruction_ >> 3) & 7; + // Determine the proper resumption address. + switch(mode) { + case 2: destination_bus_data_[0].full = program_counter_.full - 2; break; /* (An) */ + default: + destination_bus_data_[0].full = program_counter_.full; /* Everything other than (An) */ + break; + } destination_bus_data_[0].full = program_counter_.full; address_[7].full -= 4; effective_address_[1].full = address_[7].full; - break; + } break; case int(MicroOp::Action::PrepareBSR): destination_bus_data_[0].full = (decoded_instruction_ & 0xff) ? program_counter_.full - 2 : program_counter_.full;