Use a helper function for stopping the VDM (in case we add other steps for that), instead of just setting the flag to TRUE.
svn path=/branches/ntvdm/; revision=62378
if (!Success)
{
/* We failed everything, stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
}
break;
Opcode[9]);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
CpuCallLevel, MaxCpuCallLevel);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
CpuCallLevel++;
CpuSimulate = FALSE;
}
+VOID EmulatorTerminate(VOID)
+{
+ /* Stop the VDM */
+ VdmRunning = FALSE;
+}
+
VOID EmulatorInterrupt(BYTE Number)
{
/* Call the Fast486 API */
A20Line = Enabled;
}
-VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
+static VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
{
DPRINT1("NTVDM: BOP_DEBUGGER\n");
DebugBreak();
}
-VOID WINAPI EmulatorUnsimulateBop(LPWORD Stack)
+static VOID WINAPI EmulatorUnsimulateBop(LPWORD Stack)
{
EmulatorUnsimulate();
}
VDDTerminateVDM(VOID)
{
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
}
PBYTE
VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack);
-BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput);
VOID EmulatorExecute(WORD Segment, WORD Offset);
-VOID EmulatorInterrupt(BYTE Number);
-VOID EmulatorInterruptSignal(VOID);
VOID EmulatorStep(VOID);
VOID EmulatorSimulate(VOID);
VOID EmulatorUnsimulate(VOID);
-VOID EmulatorCleanup(VOID);
+VOID EmulatorTerminate(VOID);
+
+VOID EmulatorInterrupt(BYTE Number);
+VOID EmulatorInterruptSignal(VOID);
VOID EmulatorSetA20(BOOLEAN Enabled);
+BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput);
+VOID EmulatorCleanup(VOID);
+
#endif // _EMULATOR_H_
/* EOF */
case 0xFC:
case 0xFE:
{
- /* Stop the simulation */
- VdmRunning = FALSE;
+ /* Stop the VDM */
+ EmulatorTerminate();
break;
}
}
/* Check if bit 0 is unset */
if (!(Data & (1 << 0)))
{
- /* CPU disabled - end simulation */
- VdmRunning = FALSE;
+ /* CPU disabled - Stop the VDM */
+ EmulatorTerminate();
}
/* Update the A20 line setting */
if (!Success)
{
DisplayMessage(L"RegisterConsoleVDM failed with error %d\n", GetLastError());
- VdmRunning = FALSE;
+ EmulatorTerminate();
return FALSE;
}
if (!VgaAttachToConsole(Resolution))
{
DisplayMessage(L"An unexpected error occurred!\n");
- VdmRunning = FALSE;
+ EmulatorTerminate();
return FALSE;
}
if (!VgaEnterTextMode(&Resolution))
{
DisplayMessage(L"An unexpected VGA error occurred while switching into text mode.");
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
}
if (!VgaEnterGraphicsMode(&Resolution))
{
DisplayMessage(L"An unexpected VGA error occurred while switching into graphics mode.");
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
}
hConsoleMenu = ConsoleMenuControl(ConsoleOutput,
ID_SHOWHIDE_MOUSE,
ID_VDM_QUIT);
- if (hConsoleMenu != NULL)
- {
- VdmMenuPos = GetMenuItemCount(hConsoleMenu);
- AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
- DrawMenuBar(GetConsoleWindow());
- }
+ if (hConsoleMenu == NULL) return;
+
+ VdmMenuPos = GetMenuItemCount(hConsoleMenu);
+ AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
+ DrawMenuBar(GetConsoleWindow());
}
static VOID
default:
{
/* Stop the VDM if the user logs out or closes the console */
- VdmRunning = FALSE;
+ EmulatorTerminate();
}
}
return TRUE;
break;
case ID_VDM_QUIT:
- VdmRunning = FALSE;
+ /* Stop the VDM */
+ EmulatorTerminate();
break;
default:
{
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}
{
DPRINT1("Invalid VDD DLL Handle: %d\n", Entry);
/* Stop the VDM */
- VdmRunning = FALSE;
+ EmulatorTerminate();
return;
}