Fix so that MockingboardCardMgr asserts IRQ based on the wired-OR sum of all MB card's 6522s. (Fixes #1173)

This commit is contained in:
tomcw 2023-01-29 13:32:55 +00:00
parent c56d341bdb
commit cf722ff0cc
5 changed files with 23 additions and 9 deletions

View File

@ -128,7 +128,7 @@ void SY6522::UpdateIFR(BYTE clr_ifr, BYTE set_ifr /*= 0*/)
m_regs.IFR &= ~IFR_IRQ;
if (GetCardMgr().GetObj(m_slot)) // If called from MockingboardCard ctor, then CardManager::m_slot[slot] == NULL
dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(m_slot)).UpdateIRQ();
GetCardMgr().GetMockingboardCardMgr().UpdateIRQ();
}
//-----------------------------------------------------------------------------

View File

@ -288,13 +288,13 @@ void MockingboardCard::UpdateIFRandIRQ(MB_SUBUNIT* pMB, BYTE clr_mask, BYTE set_
//---------------------------------------------------------------------------
// Called from class SY6522
void MockingboardCard::UpdateIRQ(void)
bool MockingboardCard::Is6522IRQ(void)
{
// Now update the IRQ signal from all 6522s
// . OR-sum of all active TIMER1, TIMER2 & SPEECH sources (from all 6522s)
UINT bIRQ = 0;
bool irq = false;
for (UINT i = 0; i < NUM_SUBUNITS_PER_MB; i++)
bIRQ |= m_MBSubUnit[i].sy6522.GetReg(SY6522::rIFR) & 0x80;
irq |= m_MBSubUnit[i].sy6522.GetReg(SY6522::rIFR) & 0x80 ? true : false;
// NB. Mockingboard generates IRQ on both 6522s:
// . SSI263's IRQ (A/!R) is routed via the 2nd 6522 (at $Cn80) and must generate a 6502 IRQ (not NMI)
@ -302,10 +302,7 @@ void MockingboardCard::UpdateIRQ(void)
// . SC-01's IRQ (A/!R) is routed via the 6522 at $Cn00 (NB. Only the Mockingboard "Sound/Speech I" card supports the SC-01)
// Phasor's SSI263 IRQ (A/!R) line is *also* wired directly to the 6502's IRQ (as well as the 6522's CA1)
if (bIRQ)
CpuIrqAssert(IS_6522);
else
CpuIrqDeassert(IS_6522);
return irq;
}
//---------------------------------------------------------------------------

View File

@ -43,7 +43,7 @@ public:
void Get6522IrqDescription(std::string& desc);
#endif
void UpdateIRQ(void);
bool Is6522IRQ(void);
UINT64 GetLastCumulativeCycles(void);
void UpdateIFR(BYTE nDevice, BYTE clr_mask, BYTE set_mask);
BYTE GetPCR(BYTE nDevice);

View File

@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "MockingboardCardManager.h"
#include "Core.h"
#include "CardManager.h"
#include "CPU.h"
#include "Mockingboard.h"
#include "MockingboardDefs.h"
#include "Riff.h"
@ -108,6 +109,21 @@ void MockingboardCardManager::UpdateCycles(ULONG executedCycles)
}
}
void MockingboardCardManager::UpdateIRQ(void)
{
bool irq = false;
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
{
if (IsMockingboard(i))
irq |= dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(i)).Is6522IRQ();
}
if (irq)
CpuIrqAssert(IS_6522);
else
CpuIrqDeassert(IS_6522);
}
bool MockingboardCardManager::IsActive(void)
{
if (!m_mockingboardVoice.bActive)

View File

@ -26,6 +26,7 @@ public:
void MuteControl(bool mute);
void SetCumulativeCycles(void);
void UpdateCycles(ULONG executedCycles);
void UpdateIRQ(void);
bool IsActive(void);
DWORD GetVolume(void);
void SetVolume(DWORD volume, DWORD volumeMax);