| 64 | //--------------------------------------------------------------------------- |
| 65 | |
| 66 | MockingboardCard::MockingboardCard(UINT slot, SS_CARDTYPE type) : Card(type, slot), m_MBSubUnit{ {slot, type}, {slot, type} } |
| 67 | { |
| 68 | m_lastCumulativeCycle = 0; |
| 69 | m_lastAYUpdateCycle = 0; |
| 70 | |
| 71 | for (UINT i = 0; i < NUM_VOICES; i++) |
| 72 | m_ppAYVoiceBuffer[i] = new short[MAX_SAMPLES]; // Buffer can hold a max of 0.37 seconds worth of samples (16384/44100) |
| 73 | |
| 74 | m_inActiveCycleCount = 0; |
| 75 | m_regAccessedFlag = false; |
| 76 | m_isActive = false; |
| 77 | |
| 78 | m_isPhasorCard = (QueryType() == CT_Phasor); |
| 79 | SetPhasorMode(PH_Mockingboard); // + re-init's AY CLK |
| 80 | |
| 81 | m_lastMBUpdateCycle = 0; |
| 82 | m_numSamplesError = 0; |
| 83 | |
| 84 | // |
| 85 | |
| 86 | for (int id = 0; id < kNumSyncEvents; id++) |
| 87 | { |
| 88 | int syncId = (m_slot << 4) + id; // NB. Encode the slot# into the id - used by MB_SyncEventCallback() |
| 89 | m_syncEvent[id] = new SyncEvent(syncId, 0, MB_SyncEventCallback); |
| 90 | } |
| 91 | |
| 92 | for (UINT i = 0; i < NUM_SUBUNITS_PER_MB; i++) |
| 93 | { |
| 94 | m_MBSubUnit[i].nAY8910Number = i; |
| 95 | m_MBSubUnit[i].Reset(QueryType()); |
| 96 | const UINT id0 = i * SY6522::kNumTimersPer6522 + 0; // TIMER1 |
| 97 | const UINT id1 = i * SY6522::kNumTimersPer6522 + 1; // TIMER2 |
| 98 | m_MBSubUnit[i].sy6522.InitSyncEvents(m_syncEvent[id0], m_syncEvent[id1]); |
| 99 | m_MBSubUnit[i].ssi263.SetDevice(i); |
| 100 | |
| 101 | // Load speech chip config from Registry |
| 102 | uint32_t type; |
| 103 | std::string regSection = RegGetConfigSlotSection(m_slot); |
| 104 | if (i == 0) |
| 105 | RegLoadValue(regSection.c_str(), REGVALUE_MOCKINGBOARD_SSI263_SOCKET0, TRUE, &type, kSSI263A_Default); |
| 106 | else |
| 107 | RegLoadValue(regSection.c_str(), REGVALUE_MOCKINGBOARD_SSI263_SOCKET1, TRUE, &type, kSSI263B_Default); // socket-1 for main SSI263 |
| 108 | m_MBSubUnit[i].ssi263.SetType(SSI263Type(type)); |
| 109 | |
| 110 | if (i == 0) |
| 111 | { |
| 112 | uint32_t hasSC01; |
| 113 | std::string regSection = RegGetConfigSlotSection(m_slot); |
| 114 | RegLoadValue(regSection.c_str(), REGVALUE_MOCKINGBOARD_SC01, TRUE, &hasSC01, kSC01_Default == SC01 ? TRUE : FALSE); |
| 115 | m_MBSubUnit[i].ssi263.SetSC01(hasSC01 ? SC01 : SSI263Empty); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | AY8910_InitAll((int)g_fCurrentCLK6502, SAMPLE_RATE); |
| 120 | LogFileOutput("MockingboardCard::ctor: AY8910_InitAll()\n"); |
| 121 | |
| 122 | Reset(true); |
| 123 | LogFileOutput("MockingboardCard::ctor: Reset()\n"); |
nothing calls this directly
no test coverage detected