MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / LoadSnapshot

Method LoadSnapshot

source/Mockingboard.cpp:1277–1357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275}
1276
1277bool MockingboardCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
1278{
1279 if (m_slot == 0 || m_slot == 3)
1280 throw std::runtime_error("Card: wrong slot");
1281
1282 if (version < 1 || version > kUNIT_VERSION)
1283 throw std::runtime_error("Card: wrong version");
1284
1285 if (QueryType() == CT_Phasor)
1286 return Phasor_LoadSnapshot(yamlLoadHelper, version);
1287
1288 //
1289
1290 AY8910UpdateSetCycles();
1291
1292 if (version >= 6 && version <= 12)
1293 {
1294 bool isVotrax = yamlLoadHelper.LoadBool(SS_YAML_KEY_VOTRAX_PHONEME);
1295 m_MBSubUnit[0].ssi263.SetVotraxPhoneme(isVotrax); // SC01 only in subunit 0
1296 }
1297
1298 for (UINT subunit = 0; subunit < NUM_SUBUNITS_PER_MB; subunit++)
1299 {
1300 MB_SUBUNIT* pMB = &m_MBSubUnit[subunit];
1301
1302 char szNum[2] = {char('0' + subunit), 0};
1303 std::string unit = std::string(SS_YAML_KEY_MB_UNIT) + std::string(szNum);
1304 if (!yamlLoadHelper.GetSubMap(unit))
1305 throw std::runtime_error("Card: Expected key: " + unit);
1306
1307 pMB->sy6522.LoadSnapshot(yamlLoadHelper, version);
1308 UpdateIFRandIRQ(pMB, 0, pMB->sy6522.GetReg(SY6522::rIFR)); // Assert any pending IRQs (GH#677)
1309 AY8910_LoadSnapshot(yamlLoadHelper, subunit, AY8913_DEVICE_A, std::string(""));
1310
1311 pMB->ssi263.LoadSnapshot(yamlLoadHelper, PH_Mockingboard, version, subunit);
1312
1313 pMB->nAYCurrentRegister[0] = yamlLoadHelper.LoadUint(SS_YAML_KEY_AY_CURR_REG);
1314
1315 if (version == 1)
1316 {
1317 pMB->sy6522.SetTimersActiveFromSnapshot(false, false, version);
1318 }
1319 else if (version >= 2 && version <= 7)
1320 {
1321 bool timer1Active = yamlLoadHelper.LoadBool(SS_YAML_KEY_TIMER1_ACTIVE);
1322 bool timer2Active = yamlLoadHelper.LoadBool(SS_YAML_KEY_TIMER2_ACTIVE);
1323 pMB->sy6522.SetTimersActiveFromSnapshot(timer1Active, timer2Active, version);
1324 }
1325
1326 if (version <= 7)
1327 {
1328 yamlLoadHelper.LoadBool(SS_YAML_KEY_TIMER1_IRQ); // Consume redundant data
1329 yamlLoadHelper.LoadBool(SS_YAML_KEY_TIMER2_IRQ); // Consume redundant data
1330 yamlLoadHelper.LoadBool(SS_YAML_KEY_SPEECH_IRQ); // Consume redundant data
1331 }
1332
1333 pMB->state[0] = AY_INACTIVE;
1334 pMB->state[1] = AY_INACTIVE;

Callers 2

AY8910_LoadSnapshotMethod · 0.45
Phasor_LoadSnapshotMethod · 0.45

Calls 9

Get6502BaseClockFunction · 0.85
LoadBoolMethod · 0.80
SetVotraxPhonemeMethod · 0.80
GetRegMethod · 0.80
LoadUintMethod · 0.80
SetBusStateMethod · 0.80
PopMapMethod · 0.80
GetSubMapMethod · 0.45

Tested by

no test coverage detected