Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
4f466d95a1
1 changed files with 4 additions and 33 deletions
|
@ -446,7 +446,7 @@ static void SY6522_Write(BYTE nDevice, BYTE nReg, BYTE nValue)
|
|||
// Clear Timer2 Interrupt Flag.
|
||||
UpdateIFR(pMB, IxR_TIMER2);
|
||||
|
||||
pMB->sy6522.TIMER2_LATCH.h = nValue;
|
||||
pMB->sy6522.TIMER2_LATCH.h = nValue; // NB. Real 6522 doesn't have TIMER2_LATCH.h
|
||||
pMB->sy6522.TIMER2_COUNTER.w = pMB->sy6522.TIMER2_LATCH.w;
|
||||
|
||||
StartTimer2(pMB);
|
||||
|
@ -471,29 +471,14 @@ static void SY6522_Write(BYTE nDevice, BYTE nReg, BYTE nValue)
|
|||
// Clear those bits which are set in the lower 7 bits.
|
||||
nValue ^= 0x7F;
|
||||
pMB->sy6522.IER &= nValue;
|
||||
UpdateIFR(pMB, 0);
|
||||
|
||||
// Check if active timer has been disabled:
|
||||
if (((pMB->sy6522.IER & IxR_TIMER1) == 0) && pMB->bTimer1Active)
|
||||
StopTimer1(pMB);
|
||||
|
||||
if (((pMB->sy6522.IER & IxR_TIMER2) == 0) && pMB->bTimer2Active)
|
||||
StopTimer2(pMB);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set those bits which are set in the lower 7 bits.
|
||||
nValue &= 0x7F;
|
||||
pMB->sy6522.IER |= nValue;
|
||||
UpdateIFR(pMB, 0);
|
||||
|
||||
// Check if a timer interrupt has been enabled (regardless of if there's an active timer or not): GH#567
|
||||
if (pMB->sy6522.IER & IxR_TIMER1)
|
||||
StartTimer1(pMB);
|
||||
|
||||
if (pMB->sy6522.IER & IxR_TIMER2)
|
||||
StartTimer2(pMB);
|
||||
}
|
||||
UpdateIFR(pMB, 0);
|
||||
break;
|
||||
case 0x0f: // ORA_NO_HS
|
||||
break;
|
||||
|
@ -1934,22 +1919,8 @@ bool MB_UpdateCycles(ULONG uExecutedCycles)
|
|||
{
|
||||
UpdateIFR(pMB, 0, IxR_TIMER2);
|
||||
|
||||
if((pMB->sy6522.ACR & RUNMODE) == RM_ONESHOT)
|
||||
{
|
||||
StopTimer2(pMB);
|
||||
}
|
||||
else
|
||||
{
|
||||
pMB->sy6522.TIMER2_COUNTER.w += pMB->sy6522.TIMER2_LATCH.w;
|
||||
if (pMB->sy6522.TIMER2_COUNTER.w > pMB->sy6522.TIMER2_LATCH.w)
|
||||
{
|
||||
if (pMB->sy6522.TIMER2_LATCH.w)
|
||||
pMB->sy6522.TIMER2_COUNTER.w %= pMB->sy6522.TIMER2_LATCH.w;
|
||||
else
|
||||
pMB->sy6522.TIMER2_COUNTER.w = 0;
|
||||
}
|
||||
StartTimer2(pMB);
|
||||
}
|
||||
// TIMER2 only runs in one-shot mode
|
||||
StopTimer2(pMB);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue