diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 90c29507..75209075 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -79,6 +79,7 @@ FILE* g_fh = NULL; bool g_bDisableDirectInput = false; bool g_bDisableDirectSound = false; bool g_bDisableDirectSoundMockingboard = false; +int g_nMemoryClearType = -1; IPropertySheet& sg_PropertySheet = * new CPropertySheet; CSuperSerialCard sg_SSC; @@ -839,6 +840,17 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) { g_bDisableDirectSoundMockingboard = true; } + else if (strcmp(lpCmdLine, "-memclear") == 0) + { + lpCmdLine = GetCurrArg(lpNextArg); + lpNextArg = GetNextArg(lpNextArg); + g_nMemoryClearType = atoi(lpCmdLine); + if (g_nMemoryClearType < 0) + g_nMemoryClearType = 0; + else + if (g_nMemoryClearType >= NUM_MIP) + g_nMemoryClearType = NUM_MIP - 1; + } #ifdef RAMWORKS else if (strcmp(lpCmdLine, "-r") == 0) // RamWorks size [1..127] { diff --git a/source/Applewin.h b/source/Applewin.h index c5c4d3bd..2621d3ba 100644 --- a/source/Applewin.h +++ b/source/Applewin.h @@ -42,6 +42,7 @@ extern FILE* g_fh; // Filehandle for log file extern bool g_bDisableDirectInput; // Cmd line switch: don't init DI (so no DIMouse support) extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (so no MB/Speaker support) extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support +extern int g_nMemoryClearType; // Cmd line switch: use specific MIP (Memory Initialization Pattern) extern SS_CARDTYPE g_Slot4; // Mockingboard, Z80, Mouse in slot4 extern SS_CARDTYPE g_Slot5; // Mockingboard, Z80, in slot5 diff --git a/source/Memory.cpp b/source/Memory.cpp index 44022713..39d63e75 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -1391,9 +1391,15 @@ void MemReset () // OR // F2, Ctrl-F2, F7, HGR DWORD clock = getRandomTime(); - g_eMemoryInitPattern = static_cast( clock % NUM_MIP ); - if( g_eMemoryInitPattern == MIP_ZERO ) - g_eMemoryInitPattern = MIP_FF_FF_00_00; + + if ((g_nMemoryClearType >= 0) && (g_nMemoryClearType != MIP_RANDOM)) + g_eMemoryInitPattern = static_cast(g_nMemoryClearType); + else // random + { + g_eMemoryInitPattern = static_cast( clock % NUM_MIP ); + if (g_eMemoryInitPattern == MIP_RANDOM) // Twice Lucky! Force a choice. + g_eMemoryInitPattern = MIP_FF_FF_00_00; + } switch( g_eMemoryInitPattern ) { diff --git a/source/Memory.h b/source/Memory.h index f4748f82..660bb2fc 100644 --- a/source/Memory.h +++ b/source/Memory.h @@ -15,10 +15,11 @@ enum enum MemoryInitPattern_e { MIP_ZERO + , MIP_RANDOM , MIP_FF_FF_00_00 - , MIP_FF_00_FULL_PAGE - , MIP_00_FF_HALF_PAGE - , MIP_FF_00_HALF_PAGE + , MIP_FF_00_FULL_PAGE + , MIP_00_FF_HALF_PAGE + , MIP_FF_00_HALF_PAGE , NUM_MIP }; extern MemoryInitPattern_e g_eMemoryInitPattern;