diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs index e6d210d1ba..013c21c4ac 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs @@ -397,25 +397,34 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } byte read_2004() { - if (ppur.status.sl < 241) + // behaviour depends on whether things are being rendered or not + if (reg_2001.show_bg || reg_2001.show_obj) { - if (ppur.status.cycle < 64) + if (ppur.status.sl < 241) { - return 0xFF; // during this time all reads return FF - } - else if (ppur.status.cycle < 256) - { - return read_value; - } - else if (ppur.status.cycle < 320) - { - return read_value; + if (ppur.status.cycle < 64) + { + return 0xFF; // during this time all reads return FF + } + else if (ppur.status.cycle < 256) + { + return read_value; + } + else if (ppur.status.cycle < 320) + { + return read_value; + } + else + { + return soam[0]; + } } else { - return soam[0]; + return OAM[reg_2003]; } - } else + } + else { return OAM[reg_2003]; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs index c39bf92beb..8e1b801a12 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs @@ -136,13 +136,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES ppuphase = PPUPHASE.VBL; ppur.status.sl = 241; - //Not sure if this is correct. According to Matt Conte and my own tests, it is. Timing is probably off, though. - //NOTE: Not having this here breaks a Super Donkey Kong game. - reg_2003 = 0; + //Not sure if this is correct. According to Matt Conte and my own tests, it is. Timing is probably off, though. + //NOTE: Not having this here breaks a Super Donkey Kong game. + if (reg_2001.show_obj || reg_2001.show_bg) reg_2003 = 0; - //this was repeatedly finetuned from the fceux days thrugh the old cpu core and into the new one to pass 05-nmi_timing.nes - //note that there is still some leniency. for instance, 4,2 will pass in addition to 3,3 - const int delay = 6; + //this was repeatedly finetuned from the fceux days thrugh the old cpu core and into the new one to pass 05-nmi_timing.nes + //note that there is still some leniency. for instance, 4,2 will pass in addition to 3,3 + const int delay = 6; runppu(3); bool nmi_destiny = reg_2000.vblank_nmi_gen && Reg2002_vblank_active; runppu(3);