Remove softx86 support, and use only fast486, since it is now
sufficiently functional.


svn path=/branches/ntvdm/; revision=60755
This commit is contained in:
Aleksandar Andrejevic 2013-10-26 20:48:31 +00:00
parent 68de967fb2
commit 0981b0859f
4 changed files with 7 additions and 388 deletions

View file

@ -20,18 +20,13 @@
/* PRIVATE VARIABLES **********************************************************/ /* PRIVATE VARIABLES **********************************************************/
#ifndef NEW_EMULATOR
softx86_ctx EmulatorContext;
softx87_ctx FpuEmulatorContext;
#else
FAST486_STATE EmulatorContext; FAST486_STATE EmulatorContext;
#endif
static BOOLEAN A20Line = FALSE; static BOOLEAN A20Line = FALSE;
/* PRIVATE FUNCTIONS **********************************************************/ /* 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); 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); 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(Context);
UNREFERENCED_PARAMETER(Size); 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; 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; WORD StackSegment, StackPointer, CodeSegment, InstructionPointer;
BYTE IntNum; BYTE IntNum;
LPWORD Stack; LPWORD Stack;
/* Get the SS:SP */ /* Get the SS:SP */
#ifndef NEW_EMULATOR StackSegment = State->SegmentRegs[FAST486_REG_SS].Selector;
StackSegment = EmulatorContext.state->segment_reg[SX86_SREG_SS].val; StackPointer = State->GeneralRegs[FAST486_REG_ESP].LowWord;
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
/* Get the stack */ /* Get the stack */
Stack = (LPWORD)((ULONG_PTR)BaseAddress + TO_LINEAR(StackSegment, StackPointer)); 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 ***********************************************************/ /* PUBLIC FUNCTIONS ***********************************************************/
BOOLEAN EmulatorInitialize() BOOLEAN EmulatorInitialize()
@ -388,38 +337,6 @@ BOOLEAN EmulatorInitialize()
BaseAddress = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_ADDRESS); BaseAddress = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_ADDRESS);
if (BaseAddress == NULL) return FALSE; 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 */ /* Set the callbacks */
EmulatorContext.MemReadCallback = (FAST486_MEM_READ_PROC)EmulatorReadMemory; EmulatorContext.MemReadCallback = (FAST486_MEM_READ_PROC)EmulatorReadMemory;
EmulatorContext.MemWriteCallback = (FAST486_MEM_WRITE_PROC)EmulatorWriteMemory; EmulatorContext.MemWriteCallback = (FAST486_MEM_WRITE_PROC)EmulatorWriteMemory;
@ -429,7 +346,6 @@ BOOLEAN EmulatorInitialize()
/* Reset the CPU */ /* Reset the CPU */
Fast486Reset(&EmulatorContext); Fast486Reset(&EmulatorContext);
#endif
/* Enable interrupts */ /* Enable interrupts */
EmulatorSetFlag(EMULATOR_FLAG_IF); EmulatorSetFlag(EMULATOR_FLAG_IF);
@ -439,67 +355,30 @@ BOOLEAN EmulatorInitialize()
VOID EmulatorSetStack(WORD Segment, DWORD Offset) 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); Fast486SetStack(&EmulatorContext, Segment, Offset);
#endif
} }
// FIXME: This function assumes 16-bit mode!!! // FIXME: This function assumes 16-bit mode!!!
VOID EmulatorExecute(WORD Segment, WORD Offset) 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 */ /* Tell Fast486 to move the instruction pointer */
Fast486ExecuteAt(&EmulatorContext, Segment, Offset); Fast486ExecuteAt(&EmulatorContext, Segment, Offset);
#endif
} }
VOID EmulatorInterrupt(BYTE Number) 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 */ /* Call the Fast486 API */
Fast486Interrupt(&EmulatorContext, Number); Fast486Interrupt(&EmulatorContext, Number);
#endif
} }
VOID EmulatorExternalInterrupt(BYTE Number) VOID EmulatorExternalInterrupt(BYTE Number)
{ {
#ifndef NEW_EMULATOR
/* Call the softx86 API */
softx86_ext_hw_signal(&EmulatorContext, Number);
#else
/* Call the Fast486 API */ /* Call the Fast486 API */
Fast486Interrupt(&EmulatorContext, Number); Fast486Interrupt(&EmulatorContext, Number);
#endif
} }
ULONG EmulatorGetRegister(ULONG Register) 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) if (Register < EMULATOR_REG_ES)
{ {
return EmulatorContext.GeneralRegs[Register].Long; return EmulatorContext.GeneralRegs[Register].Long;
@ -508,30 +387,15 @@ ULONG EmulatorGetRegister(ULONG Register)
{ {
return EmulatorContext.SegmentRegs[Register - EMULATOR_REG_ES].Selector; return EmulatorContext.SegmentRegs[Register - EMULATOR_REG_ES].Selector;
} }
#endif
} }
ULONG EmulatorGetProgramCounter(VOID) ULONG EmulatorGetProgramCounter(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->reg_ip;
#else
return EmulatorContext.InstPtr.Long; return EmulatorContext.InstPtr.Long;
#endif
} }
VOID EmulatorSetRegister(ULONG Register, ULONG Value) 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) if (Register < EMULATOR_REG_ES)
{ {
EmulatorContext.GeneralRegs[Register].Long = Value; EmulatorContext.GeneralRegs[Register].Long = Value;
@ -540,83 +404,34 @@ VOID EmulatorSetRegister(ULONG Register, ULONG Value)
{ {
Fast486SetSegment(&EmulatorContext, Register - EMULATOR_REG_ES, (USHORT)Value); Fast486SetSegment(&EmulatorContext, Register - EMULATOR_REG_ES, (USHORT)Value);
} }
#endif
} }
BOOLEAN EmulatorGetFlag(ULONG Flag) BOOLEAN EmulatorGetFlag(ULONG Flag)
{ {
#ifndef NEW_EMULATOR
return (EmulatorContext.state->reg_flags.val & Flag) ? TRUE : FALSE;
#else
return (EmulatorContext.Flags.Long & Flag) ? TRUE : FALSE; return (EmulatorContext.Flags.Long & Flag) ? TRUE : FALSE;
#endif
} }
VOID EmulatorSetFlag(ULONG Flag) VOID EmulatorSetFlag(ULONG Flag)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->reg_flags.val |= Flag;
#else
EmulatorContext.Flags.Long |= Flag; EmulatorContext.Flags.Long |= Flag;
#endif
} }
VOID EmulatorClearFlag(ULONG Flag) VOID EmulatorClearFlag(ULONG Flag)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->reg_flags.val &= ~Flag;
#else
EmulatorContext.Flags.Long &= ~Flag; EmulatorContext.Flags.Long &= ~Flag;
#endif
} }
VOID EmulatorStep(VOID) 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 */ /* Dump the state for debugging purposes */
// Fast486DumpState(&EmulatorContext); // Fast486DumpState(&EmulatorContext);
/* Execute the next instruction */ /* Execute the next instruction */
Fast486StepInto(&EmulatorContext); Fast486StepInto(&EmulatorContext);
#endif
} }
VOID EmulatorCleanup(VOID) 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 */ /* Free the memory allocated for the 16-bit address space */
if (BaseAddress != NULL) HeapFree(GetProcessHeap(), 0, BaseAddress); if (BaseAddress != NULL) HeapFree(GetProcessHeap(), 0, BaseAddress);
} }

View file

@ -12,13 +12,7 @@
/* INCLUDES *******************************************************************/ /* INCLUDES *******************************************************************/
#include "ntvdm.h" #include "ntvdm.h"
#ifndef NEW_EMULATOR
#include <softx86.h>
#include <softx87.h>
#else
#include <fast486.h> #include <fast486.h>
#endif
/* DEFINES ********************************************************************/ /* DEFINES ********************************************************************/
@ -86,19 +80,8 @@ enum
EMULATOR_REG_GS 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; extern FAST486_STATE EmulatorContext;
#endif
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
BOOLEAN EmulatorInitialize(); BOOLEAN EmulatorInitialize();

View file

@ -27,9 +27,6 @@
#define FAR_POINTER(x) ((ULONG_PTR)BaseAddress + TO_LINEAR(HIWORD(x), LOWORD(x))) #define FAR_POINTER(x) ((ULONG_PTR)BaseAddress + TO_LINEAR(HIWORD(x), LOWORD(x)))
#define STEPS_PER_CYCLE 256 #define STEPS_PER_CYCLE 256
// Uncomment the following to use the new Fast486 CPU emulator (EXPERIMENTAL)
#define NEW_EMULATOR
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
extern LPVOID BaseAddress; extern LPVOID BaseAddress;

View file

@ -18,176 +18,112 @@ ULONG
CDECL CDECL
getEAX(VOID) getEAX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_AX].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long;
#endif
} }
VOID VOID
CDECL CDECL
setEAX(ULONG Value) setEAX(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_AX].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getAX(VOID) getAX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setAX(USHORT Value) setAX(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getAH(VOID) getAH(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte;
#endif
} }
VOID VOID
CDECL CDECL
setAH(UCHAR Value) setAH(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getAL(VOID) getAL(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte;
#endif
} }
VOID VOID
CDECL CDECL
setAL(UCHAR Value) setAL(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte = Value;
#endif
} }
ULONG ULONG
CDECL CDECL
getEBX(VOID) getEBX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_BX].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long;
#endif
} }
VOID VOID
CDECL CDECL
setEBX(ULONG Value) setEBX(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_BX].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getBX(VOID) getBX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setBX(USHORT Value) setBX(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getBH(VOID) getBH(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte;
#endif
} }
VOID VOID
CDECL CDECL
setBH(UCHAR Value) setBH(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getBL(VOID) getBL(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte;
#endif
} }
VOID VOID
CDECL CDECL
setBL(UCHAR Value) setBL(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte = Value;
#endif
} }
@ -196,88 +132,56 @@ ULONG
CDECL CDECL
getECX(VOID) getECX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_CX].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long;
#endif
} }
VOID VOID
CDECL CDECL
setECX(ULONG Value) setECX(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_CX].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getCX(VOID) getCX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setCX(USHORT Value) setCX(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getCH(VOID) getCH(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte;
#endif
} }
VOID VOID
CDECL CDECL
setCH(UCHAR Value) setCH(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getCL(VOID) getCL(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte;
#endif
} }
VOID VOID
CDECL CDECL
setCL(UCHAR Value) setCL(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte = Value;
#endif
} }
@ -286,88 +190,56 @@ ULONG
CDECL CDECL
getEDX(VOID) getEDX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_DX].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long;
#endif
} }
VOID VOID
CDECL CDECL
setEDX(ULONG Value) setEDX(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_DX].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getDX(VOID) getDX(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setDX(USHORT Value) setDX(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getDH(VOID) getDH(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte;
#endif
} }
VOID VOID
CDECL CDECL
setDH(UCHAR Value) setDH(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte = Value;
#endif
} }
UCHAR UCHAR
CDECL CDECL
getDL(VOID) getDL(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte; return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte;
#endif
} }
VOID VOID
CDECL CDECL
setDL(UCHAR Value) setDL(UCHAR Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte = Value;
#endif
} }
@ -406,44 +278,28 @@ ULONG
CDECL CDECL
getEBP(VOID) getEBP(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_BP].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long;
#endif
} }
VOID VOID
CDECL CDECL
setEBP(ULONG Value) setEBP(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_BP].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getBP(VOID) getBP(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setBP(USHORT Value) setBP(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord = Value;
#endif
} }
@ -452,44 +308,28 @@ ULONG
CDECL CDECL
getESI(VOID) getESI(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_SI].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long;
#endif
} }
VOID VOID
CDECL CDECL
setESI(ULONG Value) setESI(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_SI].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getSI(VOID) getSI(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setSI(USHORT Value) setSI(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord = Value;
#endif
} }
@ -498,44 +338,28 @@ ULONG
CDECL CDECL
getEDI(VOID) getEDI(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_DI].val;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long; return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long;
#endif
} }
VOID VOID
CDECL CDECL
setEDI(ULONG Value) setEDI(ULONG Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_DI].val = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long = Value;
#endif
} }
USHORT USHORT
CDECL CDECL
getDI(VOID) getDI(VOID)
{ {
#ifndef NEW_EMULATOR
return EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo;
#else
return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord; return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord;
#endif
} }
VOID VOID
CDECL CDECL
setDI(USHORT Value) setDI(USHORT Value)
{ {
#ifndef NEW_EMULATOR
EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo = Value;
#else
EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord = Value; EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord = Value;
#endif
} }