[NTVDM]: Add debug print for timer ticks to try to find why the emulator sometimes...
[reactos.git] / subsystems / ntvdm / ntvdm.c
index e6a33d6..004c42e 100644 (file)
 #include "emulator.h"
 
 #include "bios/bios.h"
+#include "dos/dem.h"
 #include "hardware/cmos.h"
 #include "hardware/ps2.h"
 #include "hardware/timer.h"
 #include "hardware/vga.h"
-#include "dos/dos32/dos.h"
 
 /*
  * Activate this line if you want to be able to test NTVDM with:
@@ -26,6 +26,8 @@
  */
 #define TESTING
 
+#define IPS_DISPLAY
+
 /* PUBLIC VARIABLES ***********************************************************/
 
 static HANDLE ConsoleInput  = INVALID_HANDLE_VALUE;
@@ -169,7 +171,7 @@ INT wmain(INT argc, WCHAR *argv[])
     DWORD StartTickCount, CurrentTickCount;
     DWORD LastClockUpdate;
     DWORD LastVerticalRefresh;
-#if 0
+#ifdef IPS_DISPLAY
     DWORD LastCyclePrintout;
     DWORD Cycles = 0;
 #endif
@@ -225,7 +227,7 @@ INT wmain(INT argc, WCHAR *argv[])
     }
 
     /* Initialize the VDM DOS kernel */
-    if (!DosInitialize())
+    if (!DosInitialize(NULL))
     {
         wprintf(L"FATAL: Failed to initialize the VDM DOS kernel.\n");
         goto Cleanup;
@@ -243,7 +245,11 @@ INT wmain(INT argc, WCHAR *argv[])
     QueryPerformanceCounter(&StartPerfCount);
 
     /* Set the different last counts to the starting count */
-    LastClockUpdate = LastVerticalRefresh = /*LastCyclePrintout =*/ StartTickCount;
+    LastClockUpdate = LastVerticalRefresh =
+#ifdef IPS_DISPLAY
+    LastCyclePrintout =
+#endif
+    StartTickCount;
 
     /* Set the last timer ticks to the current time */
     LastTimerTick = LastRtcTick = StartPerfCount;
@@ -317,15 +323,15 @@ INT wmain(INT argc, WCHAR *argv[])
         for (i = 0; (i < STEPS_PER_CYCLE) && VdmRunning; i++)
         {
             EmulatorStep();
-#if 0
+#ifdef IPS_DISPLAY
             Cycles++;
 #endif
         }
 
-#if 0
+#ifdef IPS_DISPLAY
         if ((CurrentTickCount - LastCyclePrintout) >= 1000)
         {
-            DPRINT1("NTVDM: %lu Instructions Per Second\n", Cycles);
+            DPRINT1("NTVDM: %lu Instructions Per Second; TimerTicks = %lu\n", Cycles, TimerTicks);
             LastCyclePrintout = CurrentTickCount;
             Cycles = 0;
         }