mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-20 00:17:16 +00:00
Documented #206 existing and new -memclear options with "In Development" in History.txt
-memclear 0 Initialize memory to zero
-memclear 1 Initialize memory to random values
-memclear 2 Initialize memory to 4 byte pattern: FF FF 00 00
-memclear 3 Initialize memory to even pages FF, odd pages 00
-memclear 4 Initialize memory to first half page 00, last half page FF
-memclear 5 Initialize memory to first half page FF, last half page 00
-memclear 6 Initialize memory to byte offset of page
(current memory address low byte)
-memclear 7 Initialize memory to page address
(current memory address high byte)
This commit is contained in:
+29
-5
@@ -1392,14 +1392,10 @@ void MemReset ()
|
||||
// F2, Ctrl-F2, F7, HGR
|
||||
DWORD clock = getRandomTime();
|
||||
|
||||
if ((g_nMemoryClearType >= 0) && (g_nMemoryClearType != MIP_RANDOM))
|
||||
if (g_nMemoryClearType >= 0)
|
||||
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>(g_nMemoryClearType);
|
||||
else // random
|
||||
{
|
||||
g_eMemoryInitPattern = static_cast<MemoryInitPattern_e>( clock % NUM_MIP );
|
||||
if (g_eMemoryInitPattern == MIP_RANDOM) // Twice Lucky! Force a choice.
|
||||
g_eMemoryInitPattern = MIP_FF_FF_00_00;
|
||||
}
|
||||
|
||||
switch( g_eMemoryInitPattern )
|
||||
{
|
||||
@@ -1442,6 +1438,34 @@ void MemReset ()
|
||||
for( iByte = 0x0000; iByte < 0xC000; iByte += 256 )
|
||||
memset( &memmain[ iByte ], 0xFF, 128 );
|
||||
break;
|
||||
|
||||
case MIP_RANDOM:
|
||||
unsigned char random[ 256 + 4 ];
|
||||
for( iByte = 0x0000; iByte < 0xC000; iByte += 256 )
|
||||
{
|
||||
for( int i = 0; i < 256; i++ )
|
||||
{
|
||||
clock = getRandomTime();
|
||||
random[ i+0 ] ^= (clock >> 0) & 0xFF;
|
||||
random[ i+1 ] ^= (clock >> 11) & 0xFF;
|
||||
}
|
||||
|
||||
memcpy( &memmain[ iByte ], random, 256 );
|
||||
}
|
||||
break;
|
||||
|
||||
case MIP_PAGE_ADDRESS_LOW:
|
||||
for( iByte = 0x0000; iByte < 0xC000; iByte++ )
|
||||
memmain[ iByte ] = iByte & 0xFF;
|
||||
break;
|
||||
|
||||
case MIP_PAGE_ADDRESS_HIGH:
|
||||
for( iByte = 0x0000; iByte < 0xC000; iByte += 256 )
|
||||
memset( &memmain[ iByte ], (iByte >> 8), 256 );
|
||||
break;
|
||||
|
||||
default: // MIP_ZERO -- nothing to do
|
||||
break;
|
||||
}
|
||||
|
||||
// https://github.com/AppleWin/AppleWin/issues/206
|
||||
|
||||
Reference in New Issue
Block a user