Improved fix for 80eb330

. During init: only need to call IoHandlerCardsOut() when loading save-state
. MemInitialize() -> MemReset() -> ResetPaging() which always inits memmode
This commit is contained in:
tomcw 2020-06-08 22:06:17 +01:00
parent 6d85c1b6bd
commit f491bb19cd
3 changed files with 10 additions and 18 deletions

View File

@ -1499,12 +1499,6 @@ void MemInitialize()
CreateLanguageCard();
// Reinit memmode on a restart (eg. h/w config changes)
if (IsApple2PlusOrClone(GetApple2Type()) && g_CardMgr.QuerySlot(SLOT0) == CT_Empty)
SetMemMode(0);
else
SetMemMode(LanguageCardUnit::kMemModeInitialState);
MemInitializeROM();
MemInitializeCustomROM();
MemInitializeCustomF8ROM();
@ -1769,19 +1763,17 @@ void MemInitializeIO(void)
if (g_CardMgr.QuerySlot(SLOT7) == CT_GenericHDD)
HD_Load_Rom(pCxRomPeripheral, SLOT7); // $C700 : HDD f/w
//
// Finally remove the cards' ROMs at $Csnn if internal ROM is enabled
// . required when restoring saved-state
if (IsAppleIIeOrAbove(GetApple2Type()) && SW_INTCXROM)
IoHandlerCardsOut();
}
// Called by:
// . Snapshot_LoadState_v2()
void MemInitializeCardExpansionRomFromSnapshot(void)
void MemInitializeCardSlotAndExpansionRomFromSnapshot(void)
{
// Remove all the cards' ROMs at $Csnn if internal ROM is enabled
if (IsAppleIIeOrAbove(GetApple2Type()) && SW_INTCXROM)
IoHandlerCardsOut();
// Potentially init a card's expansion ROM
const UINT uSlot = g_uPeripheralRomSlot;
if (ExpansionRom[uSlot] == NULL)
@ -1948,7 +1940,7 @@ void MemReset()
mem = memimage;
// INITIALIZE PAGING, FILLING IN THE 64K MEMORY IMAGE
ResetPaging(1); // Initialize=1
ResetPaging(TRUE); // Initialize=1, init memmode
// INITIALIZE & RESET THE CPU
// . Do this after ROM has been copied back to mem[], so that PC is correctly init'ed from 6502's reset vector

View File

@ -74,7 +74,7 @@ void MemInitializeROM(void);
void MemInitializeCustomROM(void);
void MemInitializeCustomF8ROM(void);
void MemInitializeIO(void);
void MemInitializeCardExpansionRomFromSnapshot(void);
void MemInitializeCardSlotAndExpansionRomFromSnapshot(void);
BYTE MemReadFloatingBus(const ULONG uExecutedCycles);
BYTE MemReadFloatingBus(const BYTE highbit, const ULONG uExecutedCycles);
void MemReset ();

View File

@ -400,7 +400,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()
MemReset(); // Also calls CpuInitialize(), CNoSlotClock.Reset()
PravetsReset();
if (g_CardMgr.IsSSCInstalled())
@ -455,7 +455,7 @@ static void Snapshot_LoadState_v2(void)
MemInitializeCustomROM();
MemInitializeCustomF8ROM();
MemInitializeIO();
MemInitializeCardExpansionRomFromSnapshot();
MemInitializeCardSlotAndExpansionRomFromSnapshot();
MemUpdatePaging(TRUE);