| 986 | } |
| 987 | |
| 988 | int MockingboardCard::MB_SyncEventCallbackInternal(int id, int /*cycles*/, ULONG uExecutedCycles) |
| 989 | { |
| 990 | //UpdateCycles(uExecutedCycles); // Underflow: so keep TIMER1/2 counters in sync |
| 991 | // Update all MBs, so that m_lastCumulativeCycle remains in sync for all |
| 992 | GetCardMgr().GetMockingboardCardMgr().UpdateCycles(uExecutedCycles); // Underflow: so keep TIMER1/2 counters in sync |
| 993 | |
| 994 | MB_SUBUNIT* pMB = &m_MBSubUnit[(id & 0xf) / SY6522::kNumTimersPer6522]; |
| 995 | |
| 996 | if ((id & 1) == 0) |
| 997 | { |
| 998 | _ASSERT(pMB->sy6522.IsTimer1Active()); |
| 999 | UpdateIFRandIRQ(pMB, 0, SY6522::IxR_TIMER1); |
| 1000 | GetCardMgr().GetMockingboardCardMgr().UpdateSoundBuffer(); |
| 1001 | |
| 1002 | if ((pMB->sy6522.GetReg(SY6522::rACR) & SY6522::ACR_RUNMODE) == SY6522::ACR_RM_FREERUNNING) |
| 1003 | { |
| 1004 | pMB->sy6522.StartTimer1(); |
| 1005 | if (pMB->sy6522.IsTimer1IrqDelay()) |
| 1006 | return 0x0001; // T1C=0xFFFF, which is really -1, as there's 1 cycle until underflow occurs |
| 1007 | // TODO: can also be 0x0002 for MegaAudio |
| 1008 | return pMB->sy6522.GetRegT1C() + SY6522::kExtraTimerCycles; |
| 1009 | } |
| 1010 | |
| 1011 | // One-shot mode |
| 1012 | // - Phasor's playback code uses one-shot mode |
| 1013 | |
| 1014 | pMB->sy6522.StopTimer1(); |
| 1015 | return 0; // Don't repeat event |
| 1016 | } |
| 1017 | else |
| 1018 | { |
| 1019 | // NB. Since not calling UpdateSoundBuffer(), then AppleWin doesn't (accurately?) support AY-playback using T2 (which is one-shot only) |
| 1020 | _ASSERT(pMB->sy6522.IsTimer2Active()); |
| 1021 | UpdateIFRandIRQ(pMB, 0, SY6522::IxR_TIMER2); |
| 1022 | |
| 1023 | pMB->sy6522.StopTimer2(); // TIMER2 only runs in one-shot mode |
| 1024 | return 0; // Don't repeat event |
| 1025 | } |
| 1026 | } |
| 1027 | |
| 1028 | //----------------------------------------------------------------------------- |
| 1029 |
no test coverage detected