Z80: Fix interrupts again

fixes #951
also made sure previous tricky IRQ games still work
This commit is contained in:
alyosha-tas 2017-08-04 15:03:22 -04:00 committed by GitHub
parent cca2adfbe1
commit 2ff7ae06ea
1 changed files with 10 additions and 12 deletions

View File

@ -12390,7 +12390,16 @@ namespace BizHawk.Emulation.Cores.Components.Z80
}
}
bool int_triggered = false;
//EI (enable interrupts) actually takes effect after the NEXT instruction
if (EI_pending > 0)
{
EI_pending--;
if (EI_pending == 0)
{
IFF1 = IFF2 = true;
}
}
// Process interrupt requests.
if (nonMaskableInterruptPending)
@ -12410,8 +12419,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80
}
else if (iff1 && interrupt && Interruptable)
{
int_triggered = true;
Halted = false;
iff1 = iff2 = false;
@ -12436,15 +12443,6 @@ namespace BizHawk.Emulation.Cores.Components.Z80
IRQCallback();
}
//EI (enable interrupts) actually takes effect after the NEXT instruction
if (EI_pending > 0)
{
EI_pending--;
if (EI_pending == 0 && !int_triggered)
{
IFF1 = IFF2 = true;
}
}
}
}