Author: aandrejevic Date: Tue Jul 2 21:40:11 2013 New Revision: 59410
URL: http://svn.reactos.org/svn/reactos?rev=59410&view=rev Log: [NTVDM] Add more debug output. [SOFTX86] Properly set the carry and overflow flags.
Modified: branches/ntvdm/lib/3rdparty/softx86/softx86/add.c branches/ntvdm/subsystems/ntvdm/bios.c branches/ntvdm/subsystems/ntvdm/emulator.c branches/ntvdm/subsystems/ntvdm/ntvdm.c
Modified: branches/ntvdm/lib/3rdparty/softx86/softx86/add.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/3rdparty/softx86/softx... ============================================================================== --- branches/ntvdm/lib/3rdparty/softx86/softx86/add.c [iso-8859-1] (original) +++ branches/ntvdm/lib/3rdparty/softx86/softx86/add.c [iso-8859-1] Tue Jul 2 21:40:11 2013 @@ -386,13 +386,13 @@ /* peform the addition */ ret = src - val;
-/* if carry/overflow */ - if (ret > src) - ctx->state->reg_flags.val |= - (SX86_CPUFLAG_CARRY | SX86_CPUFLAG_OVERFLOW); - else - ctx->state->reg_flags.val &= - ~(SX86_CPUFLAG_CARRY | SX86_CPUFLAG_OVERFLOW); +/* if carry */ + if (val > src) ctx->state->reg_flags.val |= SX86_CPUFLAG_CARRY; + else ctx->state->reg_flags.val &= ~SX86_CPUFLAG_CARRY; + +/* if overflow */ + if ((ret & 0x8000) != (src & 0x8000)) ctx->state->reg_flags.val |= SX86_CPUFLAG_OVERFLOW; + else ctx->state->reg_flags.val &= ~SX86_CPUFLAG_OVERFLOW;
/* if result treated as signed value is negative */ if (ret & 0x8000) ctx->state->reg_flags.val |= SX86_CPUFLAG_SIGN;
Modified: branches/ntvdm/subsystems/ntvdm/bios.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?re... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Tue Jul 2 21:40:11 2013 @@ -369,6 +369,12 @@ { break; } + + default: + { + DPRINT1("BIOS Function INT 10h, AH = 0x%02X NOT IMPLEMENTED\n", + HIBYTE(Eax)); + } } }
@@ -404,6 +410,12 @@
break; } + + default: + { + DPRINT1("BIOS Function INT 16h, AH = 0x%02X NOT IMPLEMENTED\n", + HIBYTE(Eax)); + } } }
@@ -441,6 +453,12 @@ BiosPassedMidnight = FALSE;
break; + } + + default: + { + DPRINT1("BIOS Function INT 1Ah, AH = 0x%02X NOT IMPLEMENTED\n", + HIBYTE(Eax)); } } }
Modified: branches/ntvdm/subsystems/ntvdm/emulator.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator.... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] Tue Jul 2 21:40:11 2013 @@ -385,6 +385,11 @@
VOID EmulatorStep() { + /* Print the current position - useful for debugging */ + DPRINT("Executing at CS:IP = %04X:%04X\n", + EmulatorGetRegister(EMULATOR_REG_CS), + EmulatorContext.state->reg_ip); + /* Call the softx86 API */ if (!softx86_step(&EmulatorContext)) {
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Tue Jul 2 21:40:11 2013 @@ -69,7 +69,10 @@ { INT i; CHAR CommandLine[128]; - DWORD CurrentTickCount, LastTickCount = 0, Cycles = 0, LastCyclePrintout = 0; + DWORD CurrentTickCount; + DWORD LastTickCount = GetTickCount(); + DWORD Cycles = 0; + DWORD LastCyclePrintout = GetTickCount(); LARGE_INTEGER Frequency, LastTimerTick, Counter; LONGLONG TimerTicks;
@@ -79,7 +82,11 @@ /* The DOS command line must be ASCII */ WideCharToMultiByte(CP_ACP, 0, GetCommandLine(), -1, CommandLine, 128, NULL, NULL);
- if (!EmulatorInitialize()) return 1; + if (!EmulatorInitialize()) + { + wprintf(L"FATAL: Failed to initialize the CPU emulator\n"); + return 1; + }
/* Initialize the performance counter (needed for hardware timers) */ if (!QueryPerformanceFrequency(&Frequency))