[NTVDM]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sat, 26 Oct 2013 20:48:31 +0000 (20:48 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sat, 26 Oct 2013 20:48:31 +0000 (20:48 +0000)
Remove softx86 support, and use only fast486, since it is now
sufficiently functional.

svn path=/branches/ntvdm/; revision=60755

subsystems/ntvdm/emulator.c
subsystems/ntvdm/emulator.h
subsystems/ntvdm/ntvdm.h
subsystems/ntvdm/registers.c

index 861d260..fb0e643 100644 (file)
 
 /* PRIVATE VARIABLES **********************************************************/
 
-#ifndef NEW_EMULATOR
-softx86_ctx EmulatorContext;
-softx87_ctx FpuEmulatorContext;
-#else
 FAST486_STATE EmulatorContext;
-#endif
 
 static BOOLEAN A20Line = FALSE;
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-static VOID NTVDMCALL EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
 {
     UNREFERENCED_PARAMETER(Context);
 
@@ -56,7 +51,7 @@ static VOID NTVDMCALL EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buf
     }
 }
 
-static VOID NTVDMCALL EmulatorWriteMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorWriteMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
 {
     UNREFERENCED_PARAMETER(Context);
 
@@ -84,7 +79,7 @@ static VOID NTVDMCALL EmulatorWriteMemory(PVOID Context, UINT Address, LPBYTE Bu
     }
 }
 
-static VOID NTVDMCALL EmulatorReadIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorReadIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
 {
     UNREFERENCED_PARAMETER(Context);
     UNREFERENCED_PARAMETER(Size);
@@ -152,7 +147,7 @@ static VOID NTVDMCALL EmulatorReadIo(PVOID Context, UINT Address, LPBYTE Buffer,
     }
 }
 
-static VOID NTVDMCALL EmulatorWriteIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorWriteIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
 {
     BYTE Byte = *Buffer;
 
@@ -228,20 +223,15 @@ static VOID NTVDMCALL EmulatorWriteIo(PVOID Context, UINT Address, LPBYTE Buffer
     }
 }
 
-static VOID EmulatorBop(WORD Code)
+static VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, WORD Code)
 {
     WORD StackSegment, StackPointer, CodeSegment, InstructionPointer;
     BYTE IntNum;
     LPWORD Stack;
 
     /* Get the SS:SP */
-#ifndef NEW_EMULATOR
-    StackSegment = EmulatorContext.state->segment_reg[SX86_SREG_SS].val;
-    StackPointer = EmulatorContext.state->general_reg[SX86_REG_SP].val;
-#else
-    StackSegment = EmulatorContext.SegmentRegs[FAST486_REG_SS].Selector;
-    StackPointer = EmulatorContext.GeneralRegs[FAST486_REG_ESP].LowWord;
-#endif
+    StackSegment = State->SegmentRegs[FAST486_REG_SS].Selector;
+    StackPointer = State->GeneralRegs[FAST486_REG_ESP].LowWord;
 
     /* Get the stack */
     Stack = (LPWORD)((ULONG_PTR)BaseAddress + TO_LINEAR(StackSegment, StackPointer));
@@ -339,47 +329,6 @@ static VOID EmulatorBop(WORD Code)
     }
 }
 
-#ifdef NEW_EMULATOR
-static VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, WORD Code)
-{
-    /*
-     * HACK: To maintain softx86 compatbility, just call the old EmulatorBop here.
-     * Later on, when softx86 is no longer needed, the code from EmulatorBop should
-     * be moved here and should use the "State" variable.
-     */
-    EmulatorBop(Code);
-}
-
-#endif
-
-#ifndef NEW_EMULATOR
-
-static VOID EmulatorSoftwareInt(PVOID Context, BYTE Number)
-{
-    UNREFERENCED_PARAMETER(Context);
-    UNREFERENCED_PARAMETER(Number);
-
-    /* Do nothing */
-}
-
-static VOID EmulatorHardwareInt(PVOID Context, BYTE Number)
-{
-    UNREFERENCED_PARAMETER(Context);
-    UNREFERENCED_PARAMETER(Number);
-
-    /* Do nothing */
-}
-
-static VOID EmulatorHardwareIntAck(PVOID Context, BYTE Number)
-{
-    UNREFERENCED_PARAMETER(Context);
-    UNREFERENCED_PARAMETER(Number);
-
-    /* Do nothing */
-}
-
-#endif
-
 /* PUBLIC FUNCTIONS ***********************************************************/
 
 BOOLEAN EmulatorInitialize()
@@ -388,38 +337,6 @@ BOOLEAN EmulatorInitialize()
     BaseAddress = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_ADDRESS);
     if (BaseAddress == NULL) return FALSE;
 
-#ifndef NEW_EMULATOR
-    /* Initialize the softx86 CPU emulator */
-    if (!softx86_init(&EmulatorContext, SX86_CPULEVEL_80286))
-    {
-        HeapFree(GetProcessHeap(), 0, BaseAddress);
-        return FALSE;
-    }
-
-    /* Initialize the softx87 FPU emulator*/
-    if(!softx87_init(&FpuEmulatorContext, SX87_FPULEVEL_8087))
-    {
-        softx86_free(&EmulatorContext);
-        HeapFree(GetProcessHeap(), 0, BaseAddress);
-        return FALSE;
-    }
-
-    /* Set memory read/write callbacks */
-    EmulatorContext.callbacks->on_read_memory = EmulatorReadMemory;
-    EmulatorContext.callbacks->on_write_memory = EmulatorWriteMemory;
-
-    /* Set MMIO read/write callbacks */
-    EmulatorContext.callbacks->on_read_io = EmulatorReadIo;
-    EmulatorContext.callbacks->on_write_io = EmulatorWriteIo;
-
-    /* Set interrupt callbacks */
-    EmulatorContext.callbacks->on_sw_int = EmulatorSoftwareInt;
-    EmulatorContext.callbacks->on_hw_int = EmulatorHardwareInt;
-    EmulatorContext.callbacks->on_hw_int_ack = EmulatorHardwareIntAck;
-
-    /* Connect the emulated FPU to the emulated CPU */
-    softx87_connect_to_CPU(&EmulatorContext, &FpuEmulatorContext);
-#else
     /* Set the callbacks */
     EmulatorContext.MemReadCallback = (FAST486_MEM_READ_PROC)EmulatorReadMemory;
     EmulatorContext.MemWriteCallback = (FAST486_MEM_WRITE_PROC)EmulatorWriteMemory;
@@ -429,7 +346,6 @@ BOOLEAN EmulatorInitialize()
 
     /* Reset the CPU */
     Fast486Reset(&EmulatorContext);
-#endif
 
     /* Enable interrupts */
     EmulatorSetFlag(EMULATOR_FLAG_IF);
@@ -439,67 +355,30 @@ BOOLEAN EmulatorInitialize()
 
 VOID EmulatorSetStack(WORD Segment, DWORD Offset)
 {
-#ifndef NEW_EMULATOR
-    /* Call the softx86 API */
-    softx86_set_stack_ptr(&EmulatorContext, Segment, Offset);
-#else
     Fast486SetStack(&EmulatorContext, Segment, Offset);
-#endif
 }
 
 // FIXME: This function assumes 16-bit mode!!!
 VOID EmulatorExecute(WORD Segment, WORD Offset)
 {
-#ifndef NEW_EMULATOR
-    /* Call the softx86 API */
-    softx86_set_instruction_ptr(&EmulatorContext, Segment, Offset);
-#else
     /* Tell Fast486 to move the instruction pointer */
     Fast486ExecuteAt(&EmulatorContext, Segment, Offset);
-#endif
 }
 
 VOID EmulatorInterrupt(BYTE Number)
 {
-#ifndef NEW_EMULATOR
-    LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress);
-    UINT Segment, Offset;
-
-    /* Get the segment and offset */
-    Segment = HIWORD(IntVecTable[Number]);
-    Offset = LOWORD(IntVecTable[Number]);
-
-    /* Call the softx86 API */
-    softx86_make_simple_interrupt_call(&EmulatorContext, &Segment, &Offset);
-#else
     /* Call the Fast486 API */
     Fast486Interrupt(&EmulatorContext, Number);
-#endif
 }
 
 VOID EmulatorExternalInterrupt(BYTE Number)
 {
-#ifndef NEW_EMULATOR
-    /* Call the softx86 API */
-    softx86_ext_hw_signal(&EmulatorContext, Number);
-#else
     /* Call the Fast486 API */
     Fast486Interrupt(&EmulatorContext, Number);
-#endif
 }
 
 ULONG EmulatorGetRegister(ULONG Register)
 {
-#ifndef NEW_EMULATOR
-    if (Register < EMULATOR_REG_ES)
-    {
-        return EmulatorContext.state->general_reg[Register].val;
-    }
-    else
-    {
-        return EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val;
-    }
-#else
     if (Register < EMULATOR_REG_ES)
     {
         return EmulatorContext.GeneralRegs[Register].Long;
@@ -508,30 +387,15 @@ ULONG EmulatorGetRegister(ULONG Register)
     {
         return EmulatorContext.SegmentRegs[Register - EMULATOR_REG_ES].Selector;
     }
-#endif
 }
 
 ULONG EmulatorGetProgramCounter(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->reg_ip;
-#else
     return EmulatorContext.InstPtr.Long;
-#endif
 }
 
 VOID EmulatorSetRegister(ULONG Register, ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    if (Register < EMULATOR_REG_ES)
-    {
-        EmulatorContext.state->general_reg[Register].val = Value;
-    }
-    else
-    {
-        EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val = (USHORT)Value;
-    }
-#else
     if (Register < EMULATOR_REG_ES)
     {
         EmulatorContext.GeneralRegs[Register].Long = Value;
@@ -540,83 +404,34 @@ VOID EmulatorSetRegister(ULONG Register, ULONG Value)
     {
         Fast486SetSegment(&EmulatorContext, Register - EMULATOR_REG_ES, (USHORT)Value);
     }
-#endif
 }
 
 BOOLEAN EmulatorGetFlag(ULONG Flag)
 {
-#ifndef NEW_EMULATOR
-    return (EmulatorContext.state->reg_flags.val & Flag) ? TRUE : FALSE;
-#else
     return (EmulatorContext.Flags.Long & Flag) ? TRUE : FALSE;
-#endif
 }
 
 VOID EmulatorSetFlag(ULONG Flag)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->reg_flags.val |= Flag;
-#else
     EmulatorContext.Flags.Long |= Flag;
-#endif
 }
 
 VOID EmulatorClearFlag(ULONG Flag)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->reg_flags.val &= ~Flag;
-#else
     EmulatorContext.Flags.Long &= ~Flag;
-#endif
 }
 
 VOID EmulatorStep(VOID)
 {
-#ifndef NEW_EMULATOR
-    LPWORD Instruction;
-
-    /* Print the current position - useful for debugging */
-    DPRINT("Executing at CS:IP = %04X:%04X\n",
-           EmulatorGetRegister(EMULATOR_REG_CS),
-           EmulatorContext.state->reg_ip);
-
-    Instruction = (LPWORD)((ULONG_PTR)BaseAddress
-                           + TO_LINEAR(EmulatorGetRegister(EMULATOR_REG_CS),
-                           EmulatorContext.state->reg_ip));
-
-    /* Check for the BIOS operation (BOP) sequence */
-    if (Instruction[0] == EMULATOR_BOP)
-    {
-        /* Skip the opcodes */
-        EmulatorContext.state->reg_ip += 4;
-
-        /* Call the BOP handler */
-        EmulatorBop(Instruction[1]);
-    }
-
-    /* Call the softx86 API */
-    if (!softx86_step(&EmulatorContext))
-    {
-        /* Invalid opcode */
-        EmulatorInterrupt(EMULATOR_EXCEPTION_INVALID_OPCODE);
-    }
-#else
     /* Dump the state for debugging purposes */
     // Fast486DumpState(&EmulatorContext);
 
     /* Execute the next instruction */
     Fast486StepInto(&EmulatorContext);
-#endif
 }
 
 VOID EmulatorCleanup(VOID)
 {
-#ifndef NEW_EMULATOR
-    /* Free the softx86 CPU and FPU emulator */
-    softx87_free(&FpuEmulatorContext);
-    softx86_free(&EmulatorContext);
-#endif
-
     /* Free the memory allocated for the 16-bit address space */
     if (BaseAddress != NULL) HeapFree(GetProcessHeap(), 0, BaseAddress);
 }
index 62895c4..0906c7d 100644 (file)
 /* INCLUDES *******************************************************************/
 
 #include "ntvdm.h"
-
-#ifndef NEW_EMULATOR
-#include <softx86.h>
-#include <softx87.h>
-#else
 #include <fast486.h>
-#endif
 
 /* DEFINES ********************************************************************/
 
@@ -86,19 +80,8 @@ enum
     EMULATOR_REG_GS
 };
 
-#ifndef NEW_EMULATOR
-
-#define NTVDMCALL __cdecl
-extern softx86_ctx EmulatorContext;
-extern softx87_ctx FpuEmulatorContext;
-
-#else
-
-#define NTVDMCALL __stdcall
 extern FAST486_STATE EmulatorContext;
 
-#endif
-
 /* FUNCTIONS ******************************************************************/
 
 BOOLEAN EmulatorInitialize();
index 479d938..f343548 100644 (file)
@@ -27,9 +27,6 @@
 #define FAR_POINTER(x) ((ULONG_PTR)BaseAddress + TO_LINEAR(HIWORD(x), LOWORD(x)))
 #define STEPS_PER_CYCLE 256
 
-// Uncomment the following to use the new Fast486 CPU emulator (EXPERIMENTAL)
-#define NEW_EMULATOR
-
 /* FUNCTIONS ******************************************************************/
 
 extern LPVOID BaseAddress;
index 3eeb114..3319a96 100644 (file)
@@ -18,176 +18,112 @@ ULONG
 CDECL
 getEAX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_AX].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long;
-#endif
 }
 
 VOID
 CDECL
 setEAX(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_AX].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getAX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setAX(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getAH(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte;
-#endif
 }
 
 VOID
 CDECL
 setAH(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getAL(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte;
-#endif
 }
 
 VOID
 CDECL
 setAL(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte = Value;
-#endif
 }
 
 ULONG
 CDECL
 getEBX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_BX].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long;
-#endif
 }
 
 VOID
 CDECL
 setEBX(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_BX].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getBX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setBX(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getBH(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte;
-#endif
 }
 
 VOID
 CDECL
 setBH(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getBL(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte;
-#endif
 }
 
 VOID
 CDECL
 setBL(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte = Value;
-#endif
 }
 
 
@@ -196,88 +132,56 @@ ULONG
 CDECL
 getECX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_CX].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long;
-#endif
 }
 
 VOID
 CDECL
 setECX(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_CX].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getCX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setCX(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getCH(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte;
-#endif
 }
 
 VOID
 CDECL
 setCH(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getCL(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte;
-#endif
 }
 
 VOID
 CDECL
 setCL(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte = Value;
-#endif
 }
 
 
@@ -286,88 +190,56 @@ ULONG
 CDECL
 getEDX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_DX].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long;
-#endif
 }
 
 VOID
 CDECL
 setEDX(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_DX].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getDX(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setDX(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getDH(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte;
-#endif
 }
 
 VOID
 CDECL
 setDH(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte = Value;
-#endif
 }
 
 UCHAR
 CDECL
 getDL(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte;
-#endif
 }
 
 VOID
 CDECL
 setDL(UCHAR Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte = Value;
-#endif
 }
 
 
@@ -406,44 +278,28 @@ ULONG
 CDECL
 getEBP(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_BP].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long;
-#endif
 }
 
 VOID
 CDECL
 setEBP(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_BP].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getBP(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setBP(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord = Value;
-#endif
 }
 
 
@@ -452,44 +308,28 @@ ULONG
 CDECL
 getESI(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_SI].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long;
-#endif
 }
 
 VOID
 CDECL
 setESI(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_SI].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getSI(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setSI(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord = Value;
-#endif
 }
 
 
@@ -498,44 +338,28 @@ ULONG
 CDECL
 getEDI(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_DI].val;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long;
-#endif
 }
 
 VOID
 CDECL
 setEDI(ULONG Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_DI].val = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long = Value;
-#endif
 }
 
 USHORT
 CDECL
 getDI(VOID)
 {
-#ifndef NEW_EMULATOR
-    return EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo;
-#else
     return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord;
-#endif
 }
 
 VOID
 CDECL
 setDI(USHORT Value)
 {
-#ifndef NEW_EMULATOR
-    EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo = Value;
-#else
     EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord = Value;
-#endif
 }