MB: Fix for SSI263 phoneme blocking enhanced disk II full-speed mode. (Fixes #1340)

This commit is contained in:
tomcw 2024-11-18 21:27:56 +00:00
parent 7f9563b8ea
commit d896e1cec2
7 changed files with 35 additions and 11 deletions

View File

@ -998,20 +998,33 @@ int MockingboardCard::MB_SyncEventCallbackInternal(int id, int /*cycles*/, ULONG
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool MockingboardCard::IsActive(void) bool MockingboardCard::IsActive(const bool isFullSpeedCheck)
{ {
// Full-speed check ignores SSI263::IsPhonemeActive(), because:
// . Once an SSI263 has started playing a phoneme (and the chip isn't powered-down) then it'll repeat it indefinitely.
// . Typically a SSI263 is "disabled" by disabling ints & setting phoneme=PAUSE(0x00) and leaving the chip powered-up.
// . So if we also checked SSI263::IsPhonemeActive(), then it'd always report the SSI263 as active, and so prohibit full-speed.
if (isFullSpeedCheck)
return m_isActive;
// Currently this codepath isn't taken - ie. isFullSpeedCheck==false (so remove this codepath for now)
#if 1
_ASSERT(0);
return m_isActive;
#else
bool isSSI263Active = false; bool isSSI263Active = false;
for (UINT i = 0; i <NUM_SSI263; i++) for (UINT i = 0; i < NUM_SSI263; i++)
isSSI263Active |= m_MBSubUnit[i].ssi263.IsPhonemeActive(); isSSI263Active |= m_MBSubUnit[i].ssi263.IsPhonemeActive();
return m_isActive || isSSI263Active; return m_isActive || isSSI263Active;
#endif
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void MockingboardCard::SetVolume(DWORD volume, DWORD volumeMax) void MockingboardCard::SetVolume(DWORD volume, DWORD volumeMax)
{ {
for (UINT i =0; i < NUM_SSI263; i++) for (UINT i = 0; i < NUM_SSI263; i++)
m_MBSubUnit[i].ssi263.SetVolume(volume, volumeMax); m_MBSubUnit[i].ssi263.SetVolume(volume, volumeMax);
} }

View File

@ -31,7 +31,7 @@ public:
void ReinitializeClock(void); void ReinitializeClock(void);
void MuteControl(bool mute); void MuteControl(bool mute);
void UpdateCycles(ULONG executedCycles); void UpdateCycles(ULONG executedCycles);
bool IsActive(void); bool IsActive(const bool isFullSpeedCheck);
void SetVolume(DWORD dwVolume, DWORD dwVolumeMax); void SetVolume(DWORD dwVolume, DWORD dwVolumeMax);
void SetCumulativeCycles(void); void SetCumulativeCycles(void);
UINT MB_Update(void); UINT MB_Update(void);

View File

@ -130,7 +130,7 @@ void MockingboardCardManager::UpdateIRQ(void)
CpuIrqDeassert(IS_6522); CpuIrqDeassert(IS_6522);
} }
bool MockingboardCardManager::IsActive(void) bool MockingboardCardManager::IsActive(const bool isFullSpeedCheck)
{ {
if (!m_mockingboardVoice.bActive) if (!m_mockingboardVoice.bActive)
return false; return false;
@ -138,7 +138,7 @@ bool MockingboardCardManager::IsActive(void)
for (UINT i = SLOT0; i < NUM_SLOTS; i++) for (UINT i = SLOT0; i < NUM_SLOTS; i++)
{ {
if (IsMockingboard(i)) if (IsMockingboard(i))
if (dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(i)).IsActive()) if (dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(i)).IsActive(isFullSpeedCheck))
return true; // if any card is true then the condition for active is true return true; // if any card is true then the condition for active is true
} }

View File

@ -29,7 +29,7 @@ public:
void SetCumulativeCycles(void); void SetCumulativeCycles(void);
void UpdateCycles(ULONG executedCycles); void UpdateCycles(ULONG executedCycles);
void UpdateIRQ(void); void UpdateIRQ(void);
bool IsActive(void); bool IsActive(const bool isFullSpeedCheck);
DWORD GetVolume(void); DWORD GetVolume(void);
void SetVolume(DWORD volume, DWORD volumeMax); void SetVolume(DWORD volume, DWORD volumeMax);
void OutputToRiff(void) { m_outputToRiff = true; } void OutputToRiff(void) { m_outputToRiff = true; }

View File

@ -417,7 +417,7 @@ void SSI263::Update(void)
if (!SSI263SingleVoice.bActive) if (!SSI263SingleVoice.bActive)
return; return;
if (g_bFullSpeed) // ie. only true when IsPhonemeActive() is true if (g_bFullSpeed) // NB. if true, then it's irrespective of IsPhonemeActive()
{ {
if (m_phonemeLengthRemaining) if (m_phonemeLengthRemaining)
{ {
@ -697,9 +697,14 @@ void SSI263::Update(void)
if (m_phonemeLeadoutLength == 0) if (m_phonemeLeadoutLength == 0)
{ {
if (!m_isVotraxPhoneme) if (!m_isVotraxPhoneme)
Play(m_durationPhoneme & PHONEME_MASK); // Repeat this phoneme again {
if ((m_ctrlArtAmp & CONTROL_MASK) == 0)
Play(m_durationPhoneme & PHONEME_MASK); // Repeat this phoneme again
}
// else // GH#1318 - remove for now, as TR v5.1 can start with repeating phoneme in debugger 'g' mode! // else // GH#1318 - remove for now, as TR v5.1 can start with repeating phoneme in debugger 'g' mode!
// {
// Play(m_Votrax2SSI263[m_votraxPhoneme]); // Votrax phoneme repeats too (tested in MAME 0.262) // Play(m_Votrax2SSI263[m_votraxPhoneme]); // Votrax phoneme repeats too (tested in MAME 0.262)
// }
} }
} }

View File

@ -74,7 +74,13 @@ public:
void DSUninit(void); void DSUninit(void);
void Reset(const bool powerCycle, const bool isPhasorCard); void Reset(const bool powerCycle, const bool isPhasorCard);
bool IsPhonemeActive(void) { return m_currentActivePhoneme >= 0; } bool IsPhonemeActive(void)
{
if (!m_isVotraxPhoneme)
return (m_ctrlArtAmp & CONTROL_MASK) == 0 && m_currentActivePhoneme >= 0;
else
return m_currentActivePhoneme >= 0;
}
BYTE Read(ULONG nExecutedCycles); BYTE Read(ULONG nExecutedCycles);
void Write(BYTE nReg, BYTE nValue); void Write(BYTE nReg, BYTE nValue);

View File

@ -179,7 +179,7 @@ static void ContinueExecution(void)
const bool bWasFullSpeed = g_bFullSpeed; const bool bWasFullSpeed = g_bFullSpeed;
g_bFullSpeed = (g_dwSpeed == SPEED_MAX) || g_bFullSpeed = (g_dwSpeed == SPEED_MAX) ||
bScrollLock_FullSpeed || bScrollLock_FullSpeed ||
(GetCardMgr().GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !GetCardMgr().GetMockingboardCardMgr().IsActive()) || (GetCardMgr().GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !GetCardMgr().GetMockingboardCardMgr().IsActive(true)) ||
IsDebugSteppingAtFullSpeed(); IsDebugSteppingAtFullSpeed();
if (g_bFullSpeed) if (g_bFullSpeed)