From c68abf4ea0e998b620390d979361de07612787c6 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 29 Oct 2023 20:16:41 +0100 Subject: [PATCH] wdc65816: fix PLB wrapping in emulation mode (#1277) >Regarding PLB, it looks like it reads from $200 and snes9x, mesen, bsnes, and the official CPU manual all got it wrong. Reproduced and verified on real hardware via https://github.com/gilyon/snes-tests --- bsnes/processor/wdc65816/instructions-other.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsnes/processor/wdc65816/instructions-other.cpp b/bsnes/processor/wdc65816/instructions-other.cpp index c7290eaa..01fb5cc4 100755 --- a/bsnes/processor/wdc65816/instructions-other.cpp +++ b/bsnes/processor/wdc65816/instructions-other.cpp @@ -205,9 +205,10 @@ E S.h = 0x01; auto WDC65816::instructionPullB() -> void { idle(); idle(); -L B = pull(); +L B = pullN(); ZF = B == 0; NF = B & 0x80; +E S.h = 0x01; } auto WDC65816::instructionPullP() -> void {