From 6fefce553a3568f39af1815918226848bbd26328 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 18 Apr 2021 18:33:16 +0100 Subject: [PATCH] MB: Support old save-states where 6522 T1 latch is 0x0000 --- bin/History.txt | 2 +- source/Mockingboard.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/History.txt b/bin/History.txt index 4e036188..f7c29a25 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -9,7 +9,7 @@ https://github.com/AppleWin/AppleWin/issues/new Tom Charlesworth -1.30.0.0 - 17 Apr 2021 +1.30.0.0 - 18 Apr 2021 ---------------------- Note: This version only works under Windows XP and later. diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index b99c692d..efea3e6f 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -1929,6 +1929,13 @@ static void LoadSnapshotSY6522(YamlLoadHelper& yamlLoadHelper, SY6522& sy6522, U sy6522.timer2IrqDelay = yamlLoadHelper.LoadUint(SS_YAML_KEY_SY6522_TIMER2_IRQ_DELAY); } + if (version < 7) + { + // Assume t1_latch was never written to (so had the old default of 0x0000) - this now results in failure of Mockingboard detection! + if (sy6522.TIMER1_LATCH.w == 0x0000) + sy6522.TIMER1_LATCH.w = 0xFFFF; // Allow Mockingboard detection to succeed + } + yamlLoadHelper.PopMap(); }