From 6582c586480493552a0b2a64c52e5fdb6c0810fb Mon Sep 17 00:00:00 2001 From: bladeoner Date: Wed, 26 Oct 2022 02:24:41 +0200 Subject: [PATCH] Snes9x - Adjust opcode timing as reported by pi1541. (#1036) * Snes9x - Adjust opcode timing as reported by pi1541. * Snes9x - Move AddCycles to be consistent with other OPs. --- source/snes9x/cpuaddr.h | 1 - source/snes9x/cpuops.cpp | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/snes9x/cpuaddr.h b/source/snes9x/cpuaddr.h index 47e1aa6..bef687e 100644 --- a/source/snes9x/cpuaddr.h +++ b/source/snes9x/cpuaddr.h @@ -513,7 +513,6 @@ static inline uint32 StackRelativeIndirectIndexed (AccessMode a) // (d,S),Y if (a & READ) OpenBus = (uint8) (addr >> 8); addr = (addr + Registers.Y.W + ICPU.ShiftedDB) & 0xffffff; - AddCycles(ONE_CYCLE); return (addr); } diff --git a/source/snes9x/cpuops.cpp b/source/snes9x/cpuops.cpp index b2342ba..c62c884 100644 --- a/source/snes9x/cpuops.cpp +++ b/source/snes9x/cpuops.cpp @@ -1406,11 +1406,13 @@ bOP(70Slow, RelativeSlow, CheckOverflow(), 0, CheckEmulation()) static void Op82 (void) { S9xSetPCBase(ICPU.ShiftedPB + RelativeLong(JUMP)); + AddCycles(ONE_CYCLE); } static void Op82Slow (void) { S9xSetPCBase(ICPU.ShiftedPB + RelativeLongSlow(JUMP)); + AddCycles(ONE_CYCLE); } /* Flag Instructions ******************************************************* */ @@ -2847,6 +2849,7 @@ static void Op22E1 (void) // Note: JSL is a new instruction, // and so doesn't respect the emu-mode stack bounds. uint32 addr = AbsoluteLong(JSR); + AddCycles(ONE_CYCLE); PushB(Registers.PB); PushW(Registers.PCw - 1); Registers.SH = 1; @@ -2856,6 +2859,7 @@ static void Op22E1 (void) static void Op22E0 (void) { uint32 addr = AbsoluteLong(JSR); + AddCycles(ONE_CYCLE); PushB(Registers.PB); PushW(Registers.PCw - 1); S9xSetPCBase(addr); @@ -2864,6 +2868,7 @@ static void Op22E0 (void) static void Op22Slow (void) { uint32 addr = AbsoluteLongSlow(JSR); + AddCycles(ONE_CYCLE); PushB(Registers.PB); PushW(Registers.PCw - 1); if (CheckEmulation())