Simplify Phasor's Echo+ mode's chip-select (#1183)

This commit is contained in:
tomcw 2023-02-21 21:32:11 +00:00
parent dc029a4700
commit bca99278b6
1 changed files with 7 additions and 16 deletions

View File

@ -197,30 +197,21 @@ void MockingboardCard::WriteToORB(BYTE subunit)
if (m_phasorEnable)
{
const int kAY0 = 2; // Phasor mode: bit4=0 (active low) selects the 1st AY8913, ie. the only AY8913 in Mockingboard mode (confirmed on real Phasor h/w)
// Echo+ mode: bit4=1 (active high) selects the 2nd AY8913
const int kAY1 = 1; // Phasor mode: bit3=0 (active low) selects the 2nd AY8913 attached to this 6522 (unavailable in Mockingboard mode)
// Echo+ mode: bit3=1 (active high) selects the 1st AY8913
const int nAY_CS = (m_phasorMode == PH_EchoPlus) ? ((value >> 3) & 3)
const int kAY1 = 1; // Phasor mode: bit3=0 (active low) selects the 2nd AY8913 attached to this 6522 (unavailable in Mockingboard mode)
// Echo+ mode: bit4=1 (active high) selects the 2nd AY8913
const int nAY_CS = (m_phasorMode == PH_EchoPlus) ? ((value >> 4) & 1) | ((value >> 2) & 2) // swap bits 4 & 3
: (m_phasorMode == PH_Phasor) ? (~(value >> 3) & 3)
: kAY0; // Anything else is Mockingboard
if (m_phasorMode == PH_EchoPlus)
{
subunit = SY6522_DEVICE_B;
if (nAY_CS & kAY0)
AY8910_Write(subunit, AY8913_DEVICE_B, value);
if (nAY_CS & kAY1)
AY8910_Write(subunit, AY8913_DEVICE_A, value);
}
else
{
if (nAY_CS & kAY0)
AY8910_Write(subunit, AY8913_DEVICE_A, value);
if (nAY_CS & kAY0)
AY8910_Write(subunit, AY8913_DEVICE_A, value);
if (nAY_CS & kAY1)
AY8910_Write(subunit, AY8913_DEVICE_B, value);
}
if (nAY_CS & kAY1)
AY8910_Write(subunit, AY8913_DEVICE_B, value);
}
else
{