Add more debug output.
[SOFTX86]
Properly set the carry and overflow flags.
svn path=/branches/ntvdm/; revision=59410
/* 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;
{
break;
}
+
+ default:
+ {
+ DPRINT1("BIOS Function INT 10h, AH = 0x%02X NOT IMPLEMENTED\n",
+ HIBYTE(Eax));
+ }
}
}
break;
}
+
+ default:
+ {
+ DPRINT1("BIOS Function INT 16h, AH = 0x%02X NOT IMPLEMENTED\n",
+ HIBYTE(Eax));
+ }
}
}
break;
}
+
+ default:
+ {
+ DPRINT1("BIOS Function INT 1Ah, AH = 0x%02X NOT IMPLEMENTED\n",
+ HIBYTE(Eax));
+ }
}
}
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))
{
{
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;
/* 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))