NoSlotClock:

. added to save-state (v6) via a new unit type 'Miscellaneous'
. added cmd line switch '-no-nsc' to configure AppleII without an NSC
This commit is contained in:
tomcw
2020-06-10 20:56:00 +01:00
parent f491bb19cd
commit c9ef6ecee1
6 changed files with 126 additions and 7 deletions
+28 -2
View File
@@ -71,10 +71,13 @@ static YamlHelper yamlHelper;
// v3: Extended: memory (added 'AnnunciatorN')
// v4: Extended: video (added 'Video Refresh Rate')
// v5: Extended: cpu (added 'Defer IRQ By 1 Opcode')
#define UNIT_APPLE2_VER 5
// v6: Added 'Unit Miscellaneous' for NoSlotClock(NSC)
#define UNIT_APPLE2_VER 6
#define UNIT_SLOTS_VER 1
#define UNIT_MISC_VER 1
//-----------------------------------------------------------------------------
void Snapshot_SetFilename(const std::string & strPathname)
@@ -134,6 +137,12 @@ static std::string GetSnapshotUnitSlotsName(void)
return name;
}
static std::string GetSnapshotUnitMiscName(void)
{
static const std::string name("Miscellaneous");
return name;
}
#define SS_YAML_KEY_MODEL "Model"
#define SS_YAML_VALUE_APPLE2 "Apple]["
@@ -353,6 +362,9 @@ static void ParseUnit(void)
if (unit == GetSnapshotUnitApple2Name())
{
ParseUnitApple2(yamlLoadHelper, unitVersion);
if (unitVersion < 6) MemInsertNoSlotClock(); // NSC always inserted
else MemRemoveNoSlotClock(); // NSC only add if there's a misc unit
}
else if (unit == MemGetSnapshotUnitAuxSlotName())
{
@@ -362,6 +374,11 @@ static void ParseUnit(void)
{
ParseSlots(yamlLoadHelper, unitVersion);
}
else if (unit == GetSnapshotUnitMiscName())
{
// NB. could extend for other misc devices - see how ParseSlots() calls GetMapNextSlotNumber()
NoSlotClockLoadSnapshot(yamlLoadHelper);
}
else
{
throw std::string(SS_YAML_KEY_UNIT ": Unknown type: " ) + unit;
@@ -400,7 +417,7 @@ static void Snapshot_LoadState_v2(void)
m_ConfigNew.m_bEnableHDD = false;
//m_ConfigNew.m_bEnableTheFreezesF8Rom = ?; // todo: when support saving config
MemReset(); // Also calls CpuInitialize(), CNoSlotClock.Reset()
MemReset(); // Also calls CpuInitialize()
PravetsReset();
if (g_CardMgr.IsSSCInstalled())
@@ -570,6 +587,15 @@ void Snapshot_SaveState(void)
if (g_CardMgr.QuerySlot(SLOT7) == CT_GenericHDD)
HD_SaveSnapshot(yamlSaveHelper);
}
// Miscellaneous
if (MemHasNoSlotClock())
{
yamlSaveHelper.UnitHdr(GetSnapshotUnitMiscName(), UNIT_MISC_VER);
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
NoSlotClockSaveSnapshot(yamlSaveHelper);
}
}
catch(std::string szMessage)
{