From 64491525b4b3f6fb74a7b4b9d6b34e7ebaaa2278 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 25 May 2022 17:01:18 -0400 Subject: [PATCH] Work further to guess at caller's intention for set_state. Probably I should just eliminate the initial reset, somehow. --- OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp b/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp index 66a00e4be..7ddf28d62 100644 --- a/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp +++ b/OSBindings/Mac/Clock SignalTests/TestRunner68000.hpp @@ -55,11 +55,13 @@ class RAM68000: public CPU::MC68000Mk2::BusHandler { void will_perform(uint32_t, uint16_t) { if(!has_run_) { - // Patch back in the status result, since reset will - // have affected that. - auto state = m68000_.get_state(); - state.registers.status = initial_state_.registers.status; - m68000_.set_state(state); + // Reapply all of initial state except the program counter and stack pointers. + // Also copy the supervisor stack pointer to the user. + const auto state = m68000_.get_state(); + initial_state_.registers.program_counter = state.registers.program_counter; + initial_state_.registers.user_stack_pointer = state.registers.supervisor_stack_pointer; + initial_state_.registers.supervisor_stack_pointer = state.registers.supervisor_stack_pointer; + m68000_.set_state(initial_state_); } --instructions_remaining_;