Set busState for 6522-A for AY_INACTIVE state

This commit is contained in:
tomcw 2024-01-30 18:22:45 +00:00
parent 16003ba507
commit 5ff43789dd
1 changed files with 8 additions and 16 deletions

View File

@ -292,6 +292,7 @@ void MockingboardCard::AY8913_Write(BYTE subunit, BYTE ay, BYTE value)
m_regAccessedFlag = true;
MB_SUBUNIT* pMB = &m_MBSubUnit[subunit];
SY6522& r6522 = (QueryType() != CT_SDMusic) ? pMB->sy6522 : m_MBSubUnit[0].sy6522;
bool busState = false; // Default: Mockingboard or Phasor(any mode) will read PortA inputs as high.
// Determine the AY8913 inputs
int nBDIR = (value & 2) ? 1 : 0;
@ -317,12 +318,11 @@ void MockingboardCard::AY8913_Write(BYTE subunit, BYTE ay, BYTE value)
case AY_READ: // 5: READ FROM PSG (need to set DDRA to input)
{
bool busState = true; // Initially default to true
if (pMB->isChipSelected[ay] && pMB->isAYLatchedAddressValid[ay])
{
r6522.SetRegIRA(AYReadReg(subunit, ay, pMB->nAYCurrentRegister[ay]) & (r6522.GetReg(SY6522::rDDRA) ^ 0xff));
else
busState = false;
busState = true;
}
if (m_phasorEnable && m_phasorMode == PH_Phasor) // GH#1192
{
@ -332,11 +332,6 @@ void MockingboardCard::AY8913_Write(BYTE subunit, BYTE ay, BYTE value)
r6522.SetRegIRA(r6522.GetReg(SY6522::rORA) | (AYReadReg(subunit, AY8913_DEVICE_B, pMB->nAYCurrentRegister[AY8913_DEVICE_B]) & (r6522.GetReg(SY6522::rDDRA) ^ 0xff)));
}
}
if (QueryType() != CT_SDMusic)
pMB->SetBusState(busState);
else
m_MBSubUnit[0].SetBusState(busState);
}
break;
@ -387,13 +382,10 @@ void MockingboardCard::AY8913_Write(BYTE subunit, BYTE ay, BYTE value)
state = nAYFunc;
if (state == AY_INACTIVE) // Mockingboard or Phasor(any mode) will read PortA inputs as high.
{
if (QueryType() != CT_SDMusic)
pMB->SetBusState(false);
else
m_MBSubUnit[0].SetBusState(false);
}
if (QueryType() == CT_SDMusic)
m_MBSubUnit[0].SetBusState(busState);
else
pMB->SetBusState(busState);
}
//-----------------------------------------------------------------------------