From d33deb676fe5695c854726dafe888636894195b7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 20 Dec 2023 15:55:00 -0500 Subject: [PATCH] Adjust (abs, y) addressing. --- .../Implementation/6502Implementation.hpp | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Processors/6502/Implementation/6502Implementation.hpp b/Processors/6502/Implementation/6502Implementation.hpp index 7c6b5ea8e..1c4bcbe5d 100644 --- a/Processors/6502/Implementation/6502Implementation.hpp +++ b/Processors/6502/Implementation/6502Implementation.hpp @@ -544,6 +544,17 @@ template void Proces break; } continue; + case CycleAddYToAddressLow: + next_address_.full = address_.full + y_; + address_.halves.low = next_address_.halves.low; + if(address_.halves.high != next_address_.halves.high) { + page_crossing_stall_read(); + break; + } + continue; + +#undef page_crossing_stall_read + case CycleAddXToAddressLowRead: next_address_.full = address_.full + x_; address_.halves.low = next_address_.halves.low; @@ -559,21 +570,18 @@ template void Proces throwaway_read(pc_.full - 1); } break; - case CycleAddYToAddressLow: - next_address_.full = address_.full + y_; - address_.halves.low = next_address_.halves.low; - if(address_.halves.high != next_address_.halves.high) { - page_crossing_stall_read(); - break; - } - continue; case CycleAddYToAddressLowRead: next_address_.full = address_.full + y_; address_.halves.low = next_address_.halves.low; - page_crossing_stall_read(); - break; -#undef page_crossing_stall_read + // A similar rule as for above applies; this one adjusts (abs, y) addressing. + + if(!is_65c02(personality) || next_address_.full == address_.full) { + throwaway_read(address_.full); + } else { + throwaway_read(pc_.full - 1); + } + break; case OperationCorrectAddressHigh: // Preserve the uncorrected address in next_address_ (albeit that it's