MB:6522: fix edge case for IRQ not firing for very small latch values. (Fixes #1175)
This commit is contained in:
parent
958c71de5f
commit
6a3a3114c7
|
@ -52,6 +52,7 @@ public:
|
||||||
USHORT GetRegT2C(void) { return m_regs.TIMER2_COUNTER.w; }
|
USHORT GetRegT2C(void) { return m_regs.TIMER2_COUNTER.w; }
|
||||||
void GetRegs(BYTE regs[SIZE_6522_REGS]) { memcpy(®s[0], (BYTE*)&m_regs, SIZE_6522_REGS); } // For debugger
|
void GetRegs(BYTE regs[SIZE_6522_REGS]) { memcpy(®s[0], (BYTE*)&m_regs, SIZE_6522_REGS); } // For debugger
|
||||||
void SetRegORA(BYTE reg) { m_regs.ORA = reg; }
|
void SetRegORA(BYTE reg) { m_regs.ORA = reg; }
|
||||||
|
bool IsTimer1IrqDelay(void) { return m_timer1IrqDelay ? true : false; }
|
||||||
|
|
||||||
BYTE Read(BYTE nReg);
|
BYTE Read(BYTE nReg);
|
||||||
void Write(BYTE nReg, BYTE nValue);
|
void Write(BYTE nReg, BYTE nValue);
|
||||||
|
|
|
@ -834,6 +834,8 @@ int MockingboardCard::MB_SyncEventCallbackInternal(int id, int /*cycles*/, ULONG
|
||||||
if ((pMB->sy6522.GetReg(SY6522::rACR) & SY6522::ACR_RUNMODE) == SY6522::ACR_RM_FREERUNNING)
|
if ((pMB->sy6522.GetReg(SY6522::rACR) & SY6522::ACR_RUNMODE) == SY6522::ACR_RM_FREERUNNING)
|
||||||
{
|
{
|
||||||
pMB->sy6522.StartTimer1();
|
pMB->sy6522.StartTimer1();
|
||||||
|
if (pMB->sy6522.IsTimer1IrqDelay())
|
||||||
|
return 0x0001; // T1C=0xFFFF, which is really -1, as there's 1 cycle until underflow occurs
|
||||||
return pMB->sy6522.GetRegT1C() + SY6522::kExtraTimerCycles;
|
return pMB->sy6522.GetRegT1C() + SY6522::kExtraTimerCycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue