Save-state: show an error MsgBox if old HDD v1 save-state and PC is in $Cnss HDD firmware

This commit is contained in:
tomcw 2019-10-13 15:48:07 +01:00
parent 2a06f32bf6
commit 1472f25bad
2 changed files with 12 additions and 3 deletions

View File

@ -16,7 +16,7 @@ Tom Charlesworth
- -clock-multiplier <value>, where value is a [0.5-3.9] base-clock multiplier (ie. same as the Config UI's slider)
- -model <apple2|apple2p|apple2e|apple2ee>
. [Change #666] Debugger: support showing video v,h and cycle count.
- videoinfo <dec|hex|apple|real> to configure display.
- added debugger command: videoinfo <dec|hex|apple|real> to configure display.
- added auto-run of DebuggerAutoRun.txt on AppleWin initial start-up.
. [Bug #700] Fixed ProDOS8 2.5.0 alpha6:
- support INC $C08B (and similar) to set LC to write mode - 65C02 only.
@ -29,6 +29,7 @@ Tom Charlesworth
- added '-s1 empty', '-s3 empty' and '-s6 empty' too.
. [Bug #404] a2audit.dsk 1.06 now working. (See #700)
. [Bug #319] SmartPort return address was wrong when crossing page (fix to slot-7 HDD's firmware).
- NB. Old save-states where the 6502's PC is in the old firmware now can't be loaded. (AppleWin will show an error)
. [PR #687] Replace char * with std::string.

View File

@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h"
#include "Applewin.h"
#include "CPU.h"
#include "DiskImage.h" // ImageError_e, Disk_Status_e
#include "DiskImageHelper.h"
#include "Frame.h"
@ -711,6 +712,10 @@ bool HD_ImageSwap(void)
//===========================================================================
// Unit version history:
// 2: Updated $Csnn firmware to fix GH#319
static const UINT kUNIT_VERSION = 2;
#define SS_YAML_VALUE_CARD_HDD "Generic HDD"
#define SS_YAML_KEY_CURRENT_UNIT "Current Unit"
@ -757,7 +762,7 @@ void HD_SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
if (!HD_CardIsEnabled())
return;
YamlSaveHelper::Slot slot(yamlSaveHelper, HD_GetSnapshotCardName(), g_uSlot, 1);
YamlSaveHelper::Slot slot(yamlSaveHelper, HD_GetSnapshotCardName(), g_uSlot, kUNIT_VERSION);
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
yamlSaveHelper.Save("%s: %d # b7=unit\n", SS_YAML_KEY_CURRENT_UNIT, g_nHD_UnitNum);
@ -836,9 +841,12 @@ bool HD_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, co
if (slot != 7) // fixme
throw std::string("Card: wrong slot");
if (version != 1)
if (version < 1 || version > kUNIT_VERSION)
throw std::string("Card: wrong version");
if (version == 1 && (regs.pc >> 8) == (0xC0|slot))
throw std::string("HDD card: 6502 is running old HDD firmware");
g_nHD_UnitNum = yamlLoadHelper.LoadUint(SS_YAML_KEY_CURRENT_UNIT); // b7=unit
g_nHD_Command = yamlLoadHelper.LoadUint(SS_YAML_KEY_COMMAND);