| 649 | } |
| 650 | |
| 651 | BYTE MockingboardCard::IOReadInternal(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nExecutedCycles) |
| 652 | { |
| 653 | GetCardMgr().GetMockingboardCardMgr().UpdateCycles(nExecutedCycles); |
| 654 | |
| 655 | #ifdef _DEBUG |
| 656 | if (!IS_APPLE2 && MemCheckINTCXROM()) |
| 657 | { |
| 658 | _ASSERT(0); // Card ROM disabled, so IO_Cxxx() returns the internal ROM |
| 659 | return ReadByteFromMemory(nAddr); |
| 660 | } |
| 661 | #endif |
| 662 | |
| 663 | if (m_isPhasorCard) |
| 664 | { |
| 665 | int CS = 0; |
| 666 | if (m_phasorMode == PH_Mockingboard) |
| 667 | CS = ( ( nAddr & 0x80 ) >> 7 ) + 1; // 1 or 2 |
| 668 | else if (m_phasorMode == PH_Phasor) |
| 669 | CS = ( ( nAddr & 0x80 ) >> 6 ) | ( ( nAddr & 0x10 ) >> 4 ); // 0, 1, 2 or 3 |
| 670 | else if (m_phasorMode == PH_EchoPlus) |
| 671 | CS = 2; |
| 672 | |
| 673 | BYTE nRes = 0; |
| 674 | |
| 675 | if (CS & 1) |
| 676 | nRes |= m_MBSubUnit[SY6522_DEVICE_A].sy6522.Read(nAddr & 0xf); |
| 677 | |
| 678 | if (CS & 2) |
| 679 | nRes |= m_MBSubUnit[SY6522_DEVICE_B].sy6522.Read(nAddr & 0xf); |
| 680 | |
| 681 | bool bAccessedDevice = (CS & 3) ? true : false; |
| 682 | |
| 683 | bool CS_SSI263 = !(nAddr & 0x10) && (nAddr & 0x60) && !(nAddr & 0x80); // SSI263 at $Cn2x and/or $Cn4x |
| 684 | |
| 685 | if (m_phasorMode == PH_Phasor && CS_SSI263) // NB. Mockingboard mode: SSI263.bit7 not readable |
| 686 | { |
| 687 | _ASSERT(!bAccessedDevice); // In Phasor native mode, 6522 & SSI263 are interleaved in $Cn10-$Cn7F card I/O memory |
| 688 | if (nAddr & 0x40) // Primary SSI263 |
| 689 | nRes = m_MBSubUnit[1].ssi263.Read(nExecutedCycles); // SSI263 only drives bit7 |
| 690 | if (nAddr & 0x20) // Secondary SSI263 |
| 691 | nRes = m_MBSubUnit[0].ssi263.Read(nExecutedCycles); // SSI263 only drives bit7 |
| 692 | bAccessedDevice = true; |
| 693 | } |
| 694 | |
| 695 | return bAccessedDevice ? nRes : MemReadFloatingBus(nExecutedCycles); |
| 696 | } |
| 697 | |
| 698 | #if DBG_MB_SS_CARD |
| 699 | if (nMB == 1) |
| 700 | return MemReadFloatingBus(nExecutedCycles); |
| 701 | #endif |
| 702 | |
| 703 | // NB. Mockingboard: SSI263.bit7 not readable |
| 704 | const BYTE subunit = QueryType() == CT_SDMusic ? SY6522_DEVICE_A : !(nAddr & 0x80) ? SY6522_DEVICE_A : SY6522_DEVICE_B; |
| 705 | const BYTE reg = nAddr & 0xf; |
| 706 | return m_MBSubUnit[subunit].sy6522.Read(reg); |
| 707 | } |
| 708 |
no test coverage detected