add_executable(ntvdm ${SOURCE})
set_module_type(ntvdm win32cui UNICODE)
target_link_libraries(ntvdm softx86 softx87)
-add_importlibs(ntvdm msvcrt user32 kernel32)
+add_importlibs(ntvdm msvcrt user32 kernel32 ntdll)
add_dependencies(ntvdm softx86 softx87)
add_cd_file(TARGET ntvdm DESTINATION reactos/system32 FOR all)
#include "ntvdm.h"
+#define NDEBUG
+
BOOLEAN VdmRunning = TRUE;
LPVOID BaseAddress = NULL;
LPCWSTR ExceptionName[] =
INT i;
BOOLEAN PrintUsage = TRUE;
CHAR CommandLine[128];
+ DWORD CurrentTickCount, LastTickCount = 0, Cycles = 0, LastCyclePrintout = 0;
LARGE_INTEGER Frequency, LastTimerTick, Counter;
LONGLONG TimerTicks;
/* Main loop */
while (VdmRunning)
{
- /* Get the current time */
+ /* Get the current number of ticks */
+ CurrentTickCount = GetTickCount();
+
+ /* Get the current performance counter value */
QueryPerformanceCounter(&Counter);
/* Get the number of PIT ticks that have passed */
for (i = 0; i < TimerTicks; i++) PitDecrementCount();
LastTimerTick = Counter;
- /* Check for console input events */
- CheckForInputEvents();
+ /* Check for console input events every millisecond */
+ if (CurrentTickCount != LastTickCount)
+ {
+ CheckForInputEvents();
+ LastTickCount = CurrentTickCount;
+ }
/* Continue CPU emulation */
EmulatorStep();
+
+ Cycles++;
+ if ((CurrentTickCount - LastCyclePrintout) >= 1000)
+ {
+ DPRINT1("NTVDM: %d Instructions Per Second\n", Cycles);
+ LastCyclePrintout = CurrentTickCount;
+ Cycles = 0;
+ }
}
Cleanup: