mirror of
https://github.com/reactos/reactos.git
synced 2024-10-14 21:25:14 +00:00
[NTVDM]
Add more debug output. [SOFTX86] Properly set the carry and overflow flags. svn path=/branches/ntvdm/; revision=59410
This commit is contained in:
parent
36f251eca0
commit
c4ef9b6f44
14
lib/3rdparty/softx86/softx86/add.c
vendored
14
lib/3rdparty/softx86/softx86/add.c
vendored
|
@ -386,13 +386,13 @@ sx86_uword op_sub16(softx86_ctx* ctx,sx86_uword src,sx86_uword val)
|
||||||
/* peform the addition */
|
/* peform the addition */
|
||||||
ret = src - val;
|
ret = src - val;
|
||||||
|
|
||||||
/* if carry/overflow */
|
/* if carry */
|
||||||
if (ret > src)
|
if (val > src) ctx->state->reg_flags.val |= SX86_CPUFLAG_CARRY;
|
||||||
ctx->state->reg_flags.val |=
|
else ctx->state->reg_flags.val &= ~SX86_CPUFLAG_CARRY;
|
||||||
(SX86_CPUFLAG_CARRY | SX86_CPUFLAG_OVERFLOW);
|
|
||||||
else
|
/* if overflow */
|
||||||
ctx->state->reg_flags.val &=
|
if ((ret & 0x8000) != (src & 0x8000)) ctx->state->reg_flags.val |= SX86_CPUFLAG_OVERFLOW;
|
||||||
~(SX86_CPUFLAG_CARRY | SX86_CPUFLAG_OVERFLOW);
|
else ctx->state->reg_flags.val &= ~SX86_CPUFLAG_OVERFLOW;
|
||||||
|
|
||||||
/* if result treated as signed value is negative */
|
/* if result treated as signed value is negative */
|
||||||
if (ret & 0x8000) ctx->state->reg_flags.val |= SX86_CPUFLAG_SIGN;
|
if (ret & 0x8000) ctx->state->reg_flags.val |= SX86_CPUFLAG_SIGN;
|
||||||
|
|
|
@ -369,6 +369,12 @@ VOID BiosVideoService()
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
DPRINT1("BIOS Function INT 10h, AH = 0x%02X NOT IMPLEMENTED\n",
|
||||||
|
HIBYTE(Eax));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +410,12 @@ VOID BiosKeyboardService()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
DPRINT1("BIOS Function INT 16h, AH = 0x%02X NOT IMPLEMENTED\n",
|
||||||
|
HIBYTE(Eax));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,6 +454,12 @@ VOID BiosTimeService()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
DPRINT1("BIOS Function INT 1Ah, AH = 0x%02X NOT IMPLEMENTED\n",
|
||||||
|
HIBYTE(Eax));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,11 @@ VOID EmulatorClearFlag(ULONG Flag)
|
||||||
|
|
||||||
VOID EmulatorStep()
|
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 */
|
/* Call the softx86 API */
|
||||||
if (!softx86_step(&EmulatorContext))
|
if (!softx86_step(&EmulatorContext))
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,7 +69,10 @@ INT wmain(INT argc, WCHAR *argv[])
|
||||||
{
|
{
|
||||||
INT i;
|
INT i;
|
||||||
CHAR CommandLine[128];
|
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;
|
LARGE_INTEGER Frequency, LastTimerTick, Counter;
|
||||||
LONGLONG TimerTicks;
|
LONGLONG TimerTicks;
|
||||||
|
|
||||||
|
@ -79,7 +82,11 @@ INT wmain(INT argc, WCHAR *argv[])
|
||||||
/* The DOS command line must be ASCII */
|
/* The DOS command line must be ASCII */
|
||||||
WideCharToMultiByte(CP_ACP, 0, GetCommandLine(), -1, CommandLine, 128, NULL, NULL);
|
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) */
|
/* Initialize the performance counter (needed for hardware timers) */
|
||||||
if (!QueryPerformanceFrequency(&Frequency))
|
if (!QueryPerformanceFrequency(&Frequency))
|
||||||
|
|
Loading…
Reference in a new issue