Mockingboard: only do multi-TIMER1 support update when 6502 interrupts are enabled. (#685)

This commit is contained in:
tomcw 2019-09-06 19:59:28 +01:00
parent ed9ae72778
commit 300494c470
3 changed files with 11 additions and 2 deletions

View File

@ -188,6 +188,11 @@ void SetActiveCpu(eCpuType cpu)
g_ActiveCPU = cpu;
}
bool Is6502InterruptEnabled(void)
{
return !(regs.ps & AF_INTERRUPT);
}
//
#include "CPU/cpu_general.inl"

View File

@ -42,3 +42,5 @@ eCpuType ProbeMainCpuDefault(eApple2Type apple2Type);
void SetMainCpuDefault(eApple2Type apple2Type);
eCpuType GetActiveCpu(void);
void SetActiveCpu(eCpuType cpu);
bool Is6502InterruptEnabled(void);

View File

@ -1797,7 +1797,7 @@ static bool CheckTimerUnderflowAndIrq(USHORT& timerCounter, int& timerIrqDelay,
// Called by:
// . CpuExecute() every ~1000 @ 1MHz
// . CheckInterruptSources() every 128 cycles
// . CheckInterruptSources() every opcode (or every 40 opcodes at full-speed)
// . MB_Read() / MB_Write()
void MB_UpdateCycles(ULONG uExecutedCycles)
{
@ -1847,7 +1847,9 @@ void MB_UpdateCycles(ULONG uExecutedCycles)
}
else // GH#685: Multiple TIMER1 interrupts
{
g_waitFirstAYWriteAfterTimer1Int = true; // Defer MB_Update() until MB_Write()
// Only allow when not in interrupt handler (ie. only allow when interrupts are enabled)
if (Is6502InterruptEnabled())
g_waitFirstAYWriteAfterTimer1Int = true; // Defer MB_Update() until MB_Write()
}
if ((pMB->sy6522.ACR & RUNMODE) == RM_ONESHOT)