mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-10 13:29:56 +00:00
Fix //c memory blast fill constant with actual 0xA0.
Remove MemReturnRandomData(), replace with getRandomTime()
This commit is contained in:
parent
7b3eac2ca4
commit
2719de8a09
@ -1357,6 +1357,11 @@ void MemInitialize()
|
|||||||
MemReset();
|
MemReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline DWORD getRandomTime()
|
||||||
|
{
|
||||||
|
return rand() ^ timeGetTime(); // We can't use g_nCumulativeCycles as it will be zero on a fresh execution.
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// Called by:
|
// Called by:
|
||||||
@ -1385,8 +1390,8 @@ void MemReset ()
|
|||||||
// F2. Ctrl-F2. CALL-151, C050 C053 C057
|
// F2. Ctrl-F2. CALL-151, C050 C053 C057
|
||||||
// OR
|
// OR
|
||||||
// F2, Ctrl-F2, F7, HGR
|
// F2, Ctrl-F2, F7, HGR
|
||||||
srand (time(NULL));
|
DWORD clock = getRandomTime();
|
||||||
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>( rand() % NUM_MIP );
|
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>( clock % NUM_MIP );
|
||||||
if( g_eMemoryInitPattern == MIP_ZERO )
|
if( g_eMemoryInitPattern == MIP_ZERO )
|
||||||
g_eMemoryInitPattern = MIP_FF_FF_00_00;
|
g_eMemoryInitPattern = MIP_FF_FF_00_00;
|
||||||
|
|
||||||
@ -1402,10 +1407,12 @@ void MemReset ()
|
|||||||
// Exceptions: xx28 xx29 xx68 xx69 Apple //e
|
// Exceptions: xx28 xx29 xx68 xx69 Apple //e
|
||||||
for( iByte = 0x0000; iByte < 0xC000; iByte += 512 )
|
for( iByte = 0x0000; iByte < 0xC000; iByte += 512 )
|
||||||
{
|
{
|
||||||
memmain[ iByte + 0x28 ] = MemReturnRandomData( 1 );
|
clock = getRandomTime();
|
||||||
memmain[ iByte + 0x29 ] = MemReturnRandomData( 0 );
|
memmain[ iByte + 0x28 ] = (clock >> 0) & 0xFF;
|
||||||
memmain[ iByte + 0x68 ] = MemReturnRandomData( 1 );
|
memmain[ iByte + 0x29 ] = (clock >> 8) & 0xFF;
|
||||||
memmain[ iByte + 0x69 ] = MemReturnRandomData( 0 );
|
clock = getRandomTime();
|
||||||
|
memmain[ iByte + 0x68 ] = (clock >> 0) & 0xFF;
|
||||||
|
memmain[ iByte + 0x69 ] = (clock >> 8) & 0xFF;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1425,16 +1432,16 @@ void MemReset ()
|
|||||||
{
|
{
|
||||||
memset( &memmain[ iByte ], 0xFF, 128 );
|
memset( &memmain[ iByte ], 0xFF, 128 );
|
||||||
|
|
||||||
// Exceptions: Emulate the Apple //c cold start memory 'blaster' pattern
|
// Exceptions: Emulate the Apple //c cold start memory 'blaster' pattern at $FCCA
|
||||||
// 2010: C0 C0 2111:C0 C0
|
// 2010: A0 A0 2111:A0 A0
|
||||||
// 2414: C0 C0 2515:C0 C0
|
// 2414: A0 A0 2515:A0 A0
|
||||||
// 2818: C0 C0 2919:C0 C0
|
// 2818: A0 A0 2919:A0 A0
|
||||||
// etc.
|
// etc.
|
||||||
int iBase = iByte - 0x80;
|
int iBase = iByte - 0x80;
|
||||||
int iPage = iBase & 0x1FFF;
|
int iPage = iBase & 0x1FFF;
|
||||||
int iAddr = 0x10 + (iPage / 0x100);
|
int iAddr = 0x10 + (iPage / 0x100);
|
||||||
memmain[ iBase + iAddr + 0 ] |= 0xC0;
|
memmain[ iBase + iAddr + 0 ] |= 0xA0;
|
||||||
memmain[ iBase + iAddr + 1 ] |= 0xC0;
|
memmain[ iBase + iAddr + 1 ] |= 0xA0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1446,9 +1453,9 @@ void MemReset ()
|
|||||||
|
|
||||||
// https://github.com/AppleWin/AppleWin/issues/206
|
// https://github.com/AppleWin/AppleWin/issues/206
|
||||||
// Work-around for a cold-booting bug in "Pooyan" which expects RNDL and RNDH to be non-zero.
|
// Work-around for a cold-booting bug in "Pooyan" which expects RNDL and RNDH to be non-zero.
|
||||||
DWORD clock = timeGetTime(); // We can't use g_nCumulativeCycles as it will be zero on a fresh execution.
|
clock = getRandomTime();
|
||||||
memmain[ 0x4E ] = MemReturnRandomData(1) | (clock >> 0) & 0xFF;
|
memmain[ 0x4E ] = 0x20 | (clock >> 0) & 0xFF;
|
||||||
memmain[ 0x4F ] = MemReturnRandomData(1) | (clock >> 8) & 0xFF;
|
memmain[ 0x4F ] = 0x20 | (clock >> 8) & 0xFF;
|
||||||
|
|
||||||
// SET UP THE MEMORY IMAGE
|
// SET UP THE MEMORY IMAGE
|
||||||
mem = memimage;
|
mem = memimage;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user