Compare commits

...

3 Commits

Author SHA1 Message Date
tomcw
c37d175452 Update comment 2024-05-05 19:43:31 +01:00
tomcw
7a6560aacf Fix comment 2024-05-05 18:16:08 +01:00
tomcw
381c90bdb1 Improve D7 support on IRQ, and improve comments throughout (eg. 6522 CA2 is not connected) 2024-05-05 15:08:38 +01:00
2 changed files with 24 additions and 32 deletions

View File

@ -405,9 +405,9 @@ bool MockingboardCard::Is6522IRQ(void)
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)
// - NB. 2nd SSI263's IRQ is routed via the 1st 6522 (at $Cn00) and again generates a 6502 IRQ
// . 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)
// . SSI263's IRQ (A/!R) is routed via the 2nd 6522's CA1 input (at $Cn80) and must generate a 6502 IRQ (not NMI)
// - NB. 2nd SSI263's IRQ is routed via the 1st 6522's CA1 input (at $Cn00) and again generates a 6502 IRQ
// . 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)
return irq;

View File

@ -140,20 +140,10 @@ void SSI263::Write(BYTE nReg, BYTE nValue)
ssiRegs[nReg] = nValue;
#endif
// Notes:
// . Phasor's text-to-speech playback has no CTL H->L
// - ISR just writes CTL=0 (and new ART+AMP values), and writes DUR=x (and new PHON)
// - since no CTL H->L, then DUR value doesn't take affect (so continue using previous)
// - so the write to DURPHON must clear the IRQ
// . Does a write of CTL=0 clear IRQ? (ie. CTL 0->0)
// . Does a write of CTL=1 clear IRQ? (ie. CTL 0->1)
// - SSI263 datasheet says: "Setting the Control bit (CTL) to a logic one puts the device into Power Down mode..."
// . Does phoneme output only happen when CTL=0? (Otherwise device is in PD mode)
// SSI263 datasheet is not clear, but a write to DURPHON must clear the IRQ.
// . Empirically writes to regs 0,1 & 2 all clear the IRQ (and writes to 3,4..7 don't) (GH#1197)
// NB. For Mockingboard, A/!R is ack'ed by 6522's PCR handshake and D7 is cleared.
if (m_cardMode == PH_Phasor && nReg <= SSI_RATEINF)
// SSI263 datasheet is not clear, but a write to DURPHON must de-assert the IRQ and clear D7.
// . Empirically writes to regs 0,1 & 2 all de-assert the IRQ (and writes to 3,4..7 don't) (GH#1197)
// NB. The same for Mockingboard as there's no automatic handshake from the 6522 (CA2 isn't connected to the SSI263). So a write to reg0, 1 or 2 completes the handshake.
if (nReg <= SSI_RATEINF)
{
CpuIrqDeassert(IS_SPEECH);
m_currentMode.D7 = 0;
@ -205,6 +195,9 @@ void SSI263::Write(BYTE nReg, BYTE nValue)
#endif
if ((m_ctrlArtAmp & CONTROL_MASK) && !(nValue & CONTROL_MASK)) // H->L
{
// NB. Just changed from CTL=1 (power-down) - where IRQ was de-asserted & D7=0
// . So CTL H->L never affects IRQ or D7
if ((m_durationPhoneme & DURATION_MODE_MASK) != MODE_IRQ_DISABLED)
{
m_currentMode.function = (m_durationPhoneme & DURATION_MODE_MASK) >> DURATION_MODE_SHIFT;
@ -214,10 +207,6 @@ void SSI263::Write(BYTE nReg, BYTE nValue)
{
// "Disables A/!R output only; does not change previous A/!R response" (SSI263 datasheet)
m_currentMode.enableInts = 0;
// TODO: What if IRQ is currently asserted? Does it deassert the IRQ?
// CpuIrqDeassert(IS_SPEECH);
// NB. D7 is not cleared -- check this
}
// Device out of power down / "standby" mode, so play phoneme
@ -765,23 +754,23 @@ void SSI263::SetSpeechIRQ(void)
{
if (!m_isVotraxPhoneme)
{
// Always set SSI263's D7 pin regardless of SSI263 mode (DR1:0), including when SSI263 ints are disabled (via MODE_IRQ_DISABLED)
m_currentMode.D7 = 1; // Set SSI263's D7 pin
if (m_currentMode.enableInts)
{
if (m_cardMode == PH_Mockingboard)
{
if ((GetPCR(m_device) & 1) == 0) // CA1 Latch/Input = 0 (Negative active edge)
UpdateIFR(m_device, 0, SY6522::IxR_SSI263);
if (GetPCR(m_device) == 0x0C) // CA2 Control = b#110 (Low output)
m_currentMode.D7 = 0; // Clear SSI263's D7 pin (cleared by 6522's PCR CA1/CA2 handshake)
// NB. Don't set CTL=1, as Mockingboard(SMS) speech doesn't work (it sets MODE_IRQ_DISABLED mode during ISR)
//pMB->SpeechChip.CtrlArtAmp |= CONTROL_MASK; // 6522's CA2 sets Power Down mode (pin 18), which sets Control bit
if (m_currentMode.D7 == 0)
{
// 6522's PCR = 0x0C (all SSI263 speech routine use this value, but 0x00 will do equally as well!)
// . b3:1 CA2 Control = b#110 (Low output) - not connected
// . b0 CA1 Latch/Input = 0 (Negative active edge) - input from SSI263's A/!R
if ((GetPCR(m_device) & 1) == 0) // Level change from SSI263's A/!R, latch this as an interrupt
UpdateIFR(m_device, 0, SY6522::IxR_SSI263);
}
}
else if (m_cardMode == PH_Phasor) // Phasor's SSI263 IRQ (A/!R) line is *also* wired directly to the 6502's IRQ (as well as the 6522's CA1)
else if (m_cardMode == PH_Phasor)
{
// Phasor (in native mode): SSI263 IRQ (A/!R) pin is wired directly to the 6502's IRQ
// . And A/!R is wired to the 6522's CA1 but only when in Mockingboard mode
CpuIrqAssert(IS_SPEECH);
}
else
@ -789,6 +778,9 @@ void SSI263::SetSpeechIRQ(void)
_ASSERT(0);
}
}
// Always set SSI263's D7 pin regardless of SSI263 mode (DR1:0), including when SSI263 ints are disabled (via MODE_IRQ_DISABLED)
m_currentMode.D7 = 1;
}
//