mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-24 16:30:01 +00:00
Save-state: alloc extra 64K banks for RamWorks card if needed
This commit is contained in:
parent
498f01edde
commit
f114a9b8fe
@ -46,7 +46,6 @@ public:
|
||||
void sound_frame( void );
|
||||
BYTE* GetAYRegsPtr( void ) { return &sound_ay_registers[0]; }
|
||||
static void SetCLK( double CLK ) { m_fCurrentCLK_AY8910 = CLK; }
|
||||
void ClearAYChangeCount( void ) { ay_change_count = 0; }
|
||||
UINT GetSnapshot(const HANDLE hFile);
|
||||
UINT SetSnapshot(const HANDLE hFile);
|
||||
|
||||
|
@ -807,8 +807,8 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
lpCmdLine = GetCurrArg(lpNextArg);
|
||||
lpNextArg = GetNextArg(lpNextArg);
|
||||
g_uMaxExPages = atoi(lpCmdLine);
|
||||
if (g_uMaxExPages > 127)
|
||||
g_uMaxExPages = 128;
|
||||
if (g_uMaxExPages > kMaxExMemoryBanks)
|
||||
g_uMaxExPages = kMaxExMemoryBanks;
|
||||
else if (g_uMaxExPages < 1)
|
||||
g_uMaxExPages = 1;
|
||||
}
|
||||
|
@ -194,9 +194,9 @@ static BOOL Pravets8charmode = 0;
|
||||
static CNoSlotClock g_NoSlotClock;
|
||||
|
||||
#ifdef RAMWORKS
|
||||
UINT g_uMaxExPages = 1; // user requested ram pages
|
||||
UINT g_uActiveBank = 0; // 0 = memaux
|
||||
static LPBYTE RWpages[128]; // pointers to RW memory banks
|
||||
UINT g_uMaxExPages = 1; // user requested ram pages (default to 1 aux bank: so total = 128KB)
|
||||
UINT g_uActiveBank = 0; // 0 = aux 64K for: //e extended 80 Col card, or //c
|
||||
static LPBYTE RWpages[kMaxExMemoryBanks]; // pointers to RW memory banks
|
||||
#endif
|
||||
|
||||
BYTE __stdcall IO_Annunciator(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCycles);
|
||||
@ -1024,7 +1024,7 @@ static LPBYTE MemGetPtrBANK1(const WORD offset, const LPBYTE pMemBase)
|
||||
if ((offset & 0xF000) != 0xC000) // Requesting RAM at physical addr $Cxxx (ie. 4K RAM BANK1)
|
||||
return NULL;
|
||||
|
||||
// fixme: Need to extend for RAMWORKS / RWpages (when pMemBase == memaux)
|
||||
// NB. This works for memaux when set to any RWpages[] value, ie. RamWork III "just works"
|
||||
const BYTE bank1page = (offset >> 8) & 0xF;
|
||||
return (memshadow[0xD0+bank1page] == pMemBase+(0xC0+bank1page)*256)
|
||||
? mem+offset+0x1000 // Return ptr to $Dxxx address - 'mem' has (a potentially dirty) 4K RAM BANK1 mapped in at $D000
|
||||
@ -1734,8 +1734,8 @@ void MemSetSnapshot(const SS_BaseMemory_v2& Memory)
|
||||
struct SS_CARD_80COL_AUX_MEMORY
|
||||
{
|
||||
SS_CARD_HDR Hdr;
|
||||
UINT NumBanks;
|
||||
UINT ActiveBank;
|
||||
UINT NumAuxBanks; // [0,1..127] 0=no aux mem, 1=128K system, etc
|
||||
UINT ActiveAuxBank; // [ 0..126] 0=memaux
|
||||
BYTE MemAux[0];
|
||||
};
|
||||
|
||||
@ -1764,8 +1764,8 @@ void MemGetSnapshotAux(const HANDLE hFile)
|
||||
g_uMaxExPages == 1 ? CT_Extended80Col :
|
||||
CT_RamWorksIII;
|
||||
|
||||
pSS->ActiveBank = g_uActiveBank;
|
||||
pSS->NumBanks = g_uMaxExPages;
|
||||
pSS->ActiveAuxBank = g_uActiveBank;
|
||||
pSS->NumAuxBanks = g_uMaxExPages;
|
||||
|
||||
for(UINT uBank = 1; uBank <= g_uMaxExPages; uBank++)
|
||||
{
|
||||
@ -1814,17 +1814,23 @@ void MemSetSnapshotAux(const HANDLE hFile)
|
||||
if (Card.Hdr.UnitHdr.hdr.v2.Length < sizeof(SS_CARD_80COL_AUX_MEMORY))
|
||||
throw std::string("Card: unit size mismatch");
|
||||
|
||||
g_uActiveBank = Card.ActiveBank;
|
||||
g_uMaxExPages = Card.NumBanks;
|
||||
if (Card.NumAuxBanks > kMaxExMemoryBanks)
|
||||
throw std::string("Card: file corrupt");
|
||||
|
||||
if (Card.ActiveAuxBank >= Card.NumAuxBanks)
|
||||
throw std::string("Card: file corrupt");
|
||||
|
||||
g_uActiveBank = Card.ActiveAuxBank;
|
||||
g_uMaxExPages = Card.NumAuxBanks;
|
||||
|
||||
for(UINT uBank = 1; uBank <= g_uMaxExPages; uBank++)
|
||||
{
|
||||
LPBYTE pBank = MemGetBankPtr(uBank);
|
||||
if (!pBank)
|
||||
{
|
||||
// todo: alloc
|
||||
_ASSERT(pBank);
|
||||
break;
|
||||
pBank = RWpages[uBank-1] = (LPBYTE) VirtualAlloc(NULL,_6502_MEM_END+1,MEM_COMMIT,PAGE_READWRITE);
|
||||
if (!pBank)
|
||||
throw std::string("Card: mem alloc failed");
|
||||
}
|
||||
|
||||
bRes = ReadFile( hFile,
|
||||
|
@ -32,6 +32,7 @@ extern LPBYTE mem;
|
||||
extern LPBYTE memdirty;
|
||||
|
||||
#ifdef RAMWORKS
|
||||
const UINT kMaxExMemoryBanks = 127; // 127 * aux mem(64K) + main mem(64K) = 8MB
|
||||
extern UINT g_uMaxExPages; // user requested ram pages (from cmd line)
|
||||
#endif
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ static DWORD WINAPI SSI263Thread(LPVOID lpParameter)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Warning! Data-race!
|
||||
// Warning! Data-race! [FIXME]
|
||||
// . SSI263Thread() can asynchronously set /g_nCurrentActivePhoneme/ to -1
|
||||
// . I have seen it on a call to Play(0,0,0)
|
||||
// . eg. could occur between [1] and [2]
|
||||
|
Loading…
x
Reference in New Issue
Block a user