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

Function MemGetBankPtr

source/Memory.cpp:1781–1801  ·  view source on GitHub ↗

Used by: . Savestate: MemSaveSnapshotMemory(), MemLoadSnapshotAux() . VidHD : SaveSnapshot(), LoadSnapshot() . Debugger : CmdMemorySave(), CmdMemoryLoad()

Source from the content-addressed store, hash-verified

1779// . VidHD : SaveSnapshot(), LoadSnapshot()
1780// . Debugger : CmdMemorySave(), CmdMemoryLoad()
1781LPBYTE MemGetBankPtr(const UINT nBank, const bool isSaveSnapshotOrDebugging/*=true*/)
1782{
1783 // Only call BackMainImage() when a consistent 64K bank is needed, eg. for saving snapshot or debugging
1784 // - for snapshot *loads* it's redundant, and worse it can corrupt pages 0 & 1 for aux banks, so must be avoided (GH#1262)
1785 if (isSaveSnapshotOrDebugging)
1786 BackMainImage(); // Flush any dirty pages to back-buffer
1787
1788#ifdef RAMWORKS
1789 if (nBank > g_uMaxExBanks)
1790 return NULL;
1791
1792 if (nBank == 0)
1793 return memmain;
1794
1795 return RWpages[nBank-1];
1796#else
1797 return (nBank == 0) ? memmain :
1798 (nBank == 1) ? memaux :
1799 NULL;
1800#endif
1801}
1802
1803//===========================================================================
1804

Callers 8

SaveSnapshotMethod · 0.85
LoadSnapshotMethod · 0.85
MemSaveSnapshotMemoryFunction · 0.85
MemSaveSnapshotAuxFunction · 0.85
MemLoadSnapshotAuxCommonFunction · 0.85
CmdMemoryLoadFunction · 0.85
CmdMemorySaveFunction · 0.85

Calls 1

BackMainImageFunction · 0.85

Tested by

no test coverage detected