From 3cb5684d95cb245463cf5e72b3ccc5731eb44246 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 25 Dec 2019 19:49:20 -0500 Subject: [PATCH] Fixes RTR: the whole top half of the SR should be preserved. Specifically, the 68000 Reference Manual says: "The supervisor portion of the status register is unaffected." Clearly when I first read that I misread it as the supervisor _flag_ (rather than _portion_) should be preserved. --- Processors/68000/Implementation/68000Implementation.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index d8a23b6d4..c05bb97fa 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -1854,11 +1854,11 @@ template void Proces RTE and RTR share an implementation. */ case Operation::RTE_RTR: - // If this is RTR, patch out the is_supervisor bit. + // If this is RTR, patch out the supervisor half of the status register. if(decoded_instruction_.full == 0x4e77) { - source_bus_data_[0].full = - (source_bus_data_[0].full & uint32_t(~(1 << 13))) | - uint32_t(is_supervisor_ << 13); + const auto current_status = get_status(); + source_bus_data_[0].halves.low.halves.high = + uint8_t(current_status >> 8); } set_status(source_bus_data_[0].full); break;