From bca99278b6f5033ef18891f4c22ffd472b4315eb Mon Sep 17 00:00:00 2001 From: tomcw Date: Tue, 21 Feb 2023 21:32:11 +0000 Subject: [PATCH] Simplify Phasor's Echo+ mode's chip-select (#1183) --- source/Mockingboard.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 9d595842..67160934 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -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 {