From cd9204b5e4646e418b91f105b6f16f0decd43775 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Mon, 5 Sep 2016 22:37:47 -0400 Subject: [PATCH] Fix timer IRQs I think this is correct, Druid works now and I didn't notice any problems on zelda. --- .../Consoles/Nintendo/NES/FDS/FDS.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs index 5ee8dae686..9f46fdf560 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs @@ -255,12 +255,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES case 0x0020: timerlatch &= 0xff00; timerlatch |= value; - timerirq = false; + //timerirq = false; break; case 0x0021: timerlatch &= 0x00ff; timerlatch |= value << 8; - timerirq = false; + //timerirq = false; break; case 0x0022: timerreg = (byte)(value & 3); @@ -344,14 +344,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override void ClockCPU() { - if ((timerreg & 2) != 0 && timervalue > 0) + if ((timerreg & 2) != 0)// && timervalue > 0) { - timervalue--; + if (timervalue!=0) + { + timervalue--; + } if (timervalue == 0) { + + /* if ((timerreg & 1) != 0) { timervalue = timerlatch; + //timervalue = 0xFFFF; } else { @@ -359,6 +365,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES timervalue = 0; timerlatch = 0; } + */ + timervalue = timerlatch; timerirq = true; } }