{
INT i;
CHAR CommandLine[DOS_CMDLINE_LENGTH];
- DWORD CurrentTickCount;
- DWORD Cycles = 0;
- DWORD LastCyclePrintout = GetTickCount();
- DWORD LastVerticalRefresh = GetTickCount();
- DWORD LastClockUpdate = GetTickCount();
+ LARGE_INTEGER StartPerfCount;
LARGE_INTEGER Frequency, LastTimerTick, LastRtcTick, Counter;
LONGLONG TimerTicks;
- LARGE_INTEGER StartPerfCount;
- DWORD StartTickCount;
+ DWORD StartTickCount, CurrentTickCount;
+ DWORD LastClockUpdate;
+ DWORD LastVerticalRefresh;
+ DWORD LastCyclePrintout;
+ DWORD Cycles = 0;
/* Set the handler routine */
SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE);
wprintf(L"FATAL: Failed to initialize the CPU emulator\n");
goto Cleanup;
}
-
+
/* Initialize the performance counter (needed for hardware timers) */
if (!QueryPerformanceFrequency(&Frequency))
{
/* Find the starting performance and tick count */
StartTickCount = GetTickCount();
QueryPerformanceCounter(&StartPerfCount);
-
+
+ /* Set the different last counts to the starting count */
+ LastClockUpdate = LastVerticalRefresh = LastCyclePrintout = StartTickCount;
+
/* Set the last timer ticks to the current time */
LastTimerTick = LastRtcTick = StartPerfCount;
/* Get the current number of ticks */
CurrentTickCount = GetTickCount();
-
+
if ((PitResolution <= 1000) && (RtcFrequency <= 1000))
{
/* Calculate the approximate performance counter value instead */
/* Get the current performance counter value */
QueryPerformanceCounter(&Counter);
}
-
+
/* Get the number of PIT ticks that have passed */
TimerTicks = ((Counter.QuadPart - LastTimerTick.QuadPart)
* PIT_BASE_FREQUENCY) / Frequency.QuadPart;