From 0669476250906963fcdb05e30bdcfd69daf39797 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Thu, 8 Sep 2016 11:56:54 -0400 Subject: [PATCH] Fix Mapper 45 following FCEUX and Nestopia --- .../Consoles/Nintendo/NES/Boards/Mapper045.cs | 37 +++++-------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs index 84ec00b0e7..2a56268faa 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs @@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES regs[cur_reg] = value; IncrementCounter(); Sync45(); - } + } } private void Sync45() @@ -94,37 +94,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES private int CHR_AND() { - switch (regs[2] & 0x0F) + + if (regs[2]==0) { - default: - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - return 0x00; - case 8: - return 0x01; - case 9: - case 0xA: - case 0xB: - case 0xC: - - case 0xD: - return 0x3F; - case 0xE: - return 0x7F; - case 0xF: - return 0xFF; - } + return 0xFF; + } + return (0xFF >> ~((regs[2] & 0x0F)|0xF0)); } private int CHR_OR() { - int x = regs[0] | ((regs[2] >> 4) << 8); + int temp = regs[2] >> 4; + temp = temp << 8; + + int x = regs[0] | (temp); return x; }