6522: fix reading IRB - used as MB detection by Werewolf! (#1260)

This commit is contained in:
tomcw 2023-12-29 10:16:51 +00:00
parent 370b5f910c
commit a8de7f2030
3 changed files with 6 additions and 5 deletions

View File

@ -349,11 +349,11 @@ BYTE SY6522::Read(BYTE nReg)
switch (nReg)
{
case 0x00: // ORB
nValue = m_regs.ORB;
case 0x00: // IRB
nValue = m_regs.ORB | (m_regs.DDRB ^ 0xff); // Input bits read back as 1's (GH#1260)
break;
case 0x01: // ORA
nValue = m_regs.ORA;
case 0x01: // IRA
nValue = m_regs.ORA; // NB. Inputs bits driven by AY8913
break;
case 0x02: // DDRB
nValue = m_regs.DDRB;

View File

@ -49,6 +49,7 @@ public:
_ASSERT(0);
return 0;
}
BYTE GetBusViewOfORB(void) { return m_regs.ORB & m_regs.DDRB; } // Return how the AY8913 sees ORB on the bus (ie. not CPU's view which will be OR'd with !DDRB)
USHORT GetRegT1C(void) { return m_regs.TIMER1_COUNTER.w; }
USHORT GetRegT2C(void) { return m_regs.TIMER2_COUNTER.w; }
void GetRegs(BYTE regs[SIZE_6522_REGS]) { memcpy(&regs[0], (BYTE*)&m_regs, SIZE_6522_REGS); } // For debugger

View File

@ -208,7 +208,7 @@ void MockingboardCard::Get6522IrqDescription(std::string& desc)
void MockingboardCard::WriteToORB(BYTE subunit, BYTE subunitForAY/*=0*/)
{
BYTE value = m_MBSubUnit[subunit].sy6522.Read(SY6522::rORB);
BYTE value = m_MBSubUnit[subunit].sy6522.GetBusViewOfORB();
if ((QueryType() == CT_MockingboardC || QueryType() == CT_Phasor) && // Not CT_MegaAudio/CT_SDMusic
subunit == 0 && // SC01 only at $Cn00 (not $Cn80)