svn path=/branches/ntvdm/; revision=60769
/* PRIVATE FUNCTIONS **********************************************************/
/* PRIVATE FUNCTIONS **********************************************************/
-static VOID WINAPI EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorReadMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
- UNREFERENCED_PARAMETER(Context);
+ UNREFERENCED_PARAMETER(State);
/* If the A20 line is disabled, mask bit 20 */
if (!A20Line) Address &= ~(1 << 20);
/* If the A20 line is disabled, mask bit 20 */
if (!A20Line) Address &= ~(1 << 20);
&& (Address < VgaGetVideoLimitAddress()))
{
DWORD VgaAddress = max(Address, VgaGetVideoBaseAddress());
&& (Address < VgaGetVideoLimitAddress()))
{
DWORD VgaAddress = max(Address, VgaGetVideoBaseAddress());
- LPBYTE VgaBuffer = &Buffer[VgaAddress - Address];
+ LPBYTE VgaBuffer = (LPBYTE)((ULONG_PTR)Buffer + VgaAddress - Address);
/* Read from the VGA memory */
VgaReadMemory(VgaAddress, VgaBuffer, Size);
}
}
/* Read from the VGA memory */
VgaReadMemory(VgaAddress, VgaBuffer, Size);
}
}
-static VOID WINAPI EmulatorWriteMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorWriteMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
- UNREFERENCED_PARAMETER(Context);
+ UNREFERENCED_PARAMETER(State);
/* If the A20 line is disabled, mask bit 20 */
if (!A20Line) Address &= ~(1 << 20);
/* If the A20 line is disabled, mask bit 20 */
if (!A20Line) Address &= ~(1 << 20);
&& (Address < VgaGetVideoLimitAddress()))
{
DWORD VgaAddress = max(Address, VgaGetVideoBaseAddress());
&& (Address < VgaGetVideoLimitAddress()))
{
DWORD VgaAddress = max(Address, VgaGetVideoBaseAddress());
- LPBYTE VgaBuffer = &Buffer[VgaAddress - Address];
+ LPBYTE VgaBuffer = (LPBYTE)((ULONG_PTR)Buffer + VgaAddress - Address);
/* Write to the VGA memory */
VgaWriteMemory(VgaAddress, VgaBuffer, Size);
}
}
/* Write to the VGA memory */
VgaWriteMemory(VgaAddress, VgaBuffer, Size);
}
}
-static VOID WINAPI EmulatorReadIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size)
- UNREFERENCED_PARAMETER(Context);
+ LPBYTE Address = (LPBYTE)Buffer;
+
+ UNREFERENCED_PARAMETER(State);
UNREFERENCED_PARAMETER(Size);
UNREFERENCED_PARAMETER(Size);
{
case PIC_MASTER_CMD:
case PIC_SLAVE_CMD:
{
{
case PIC_MASTER_CMD:
case PIC_SLAVE_CMD:
{
- *Buffer = PicReadCommand(Address);
+ *Address = PicReadCommand(Port);
break;
}
case PIC_MASTER_DATA:
case PIC_SLAVE_DATA:
{
break;
}
case PIC_MASTER_DATA:
case PIC_SLAVE_DATA:
{
- *Buffer = PicReadData(Address);
+ *Address = PicReadData(Port);
case PIT_DATA_PORT(1):
case PIT_DATA_PORT(2):
{
case PIT_DATA_PORT(1):
case PIT_DATA_PORT(2):
{
- *Buffer = PitReadData(Address - PIT_DATA_PORT(0));
+ *Address = PitReadData(Port - PIT_DATA_PORT(0));
break;
}
case PS2_CONTROL_PORT:
{
break;
}
case PS2_CONTROL_PORT:
{
- *Buffer = KeyboardReadStatus();
+ *Address = KeyboardReadStatus();
break;
}
case PS2_DATA_PORT:
{
break;
}
case PS2_DATA_PORT:
{
- *Buffer = KeyboardReadData();
+ *Address = KeyboardReadData();
case VGA_STAT_MONO:
case VGA_STAT_COLOR:
{
case VGA_STAT_MONO:
case VGA_STAT_COLOR:
{
- *Buffer = VgaReadPort(Address);
+ *Address = VgaReadPort(Port);
- DPRINT1("Read from unknown port: 0x%X\n", Address);
+ DPRINT1("Read from unknown port: 0x%X\n", Port);
-static VOID WINAPI EmulatorWriteIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
+static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size)
+ BYTE Byte = *(LPBYTE)Buffer;
- UNREFERENCED_PARAMETER(Context);
+ UNREFERENCED_PARAMETER(State);
UNREFERENCED_PARAMETER(Size);
UNREFERENCED_PARAMETER(Size);
{
case PIT_COMMAND_PORT:
{
{
case PIT_COMMAND_PORT:
{
case PIT_DATA_PORT(1):
case PIT_DATA_PORT(2):
{
case PIT_DATA_PORT(1):
case PIT_DATA_PORT(2):
{
- PitWriteData(Address - PIT_DATA_PORT(0), Byte);
+ PitWriteData(Port - PIT_DATA_PORT(0), Byte);
break;
}
case PIC_MASTER_CMD:
case PIC_SLAVE_CMD:
{
break;
}
case PIC_MASTER_CMD:
case PIC_SLAVE_CMD:
{
- PicWriteCommand(Address, Byte);
+ PicWriteCommand(Port, Byte);
break;
}
case PIC_MASTER_DATA:
case PIC_SLAVE_DATA:
{
break;
}
case PIC_MASTER_DATA:
case PIC_SLAVE_DATA:
{
- PicWriteData(Address, Byte);
+ PicWriteData(Port, Byte);
case VGA_STAT_MONO:
case VGA_STAT_COLOR:
{
case VGA_STAT_MONO:
case VGA_STAT_COLOR:
{
- VgaWritePort(Address, Byte);
+ VgaWritePort(Port, Byte);
- DPRINT1("Write to unknown port: 0x%X\n", Address);
+ DPRINT1("Write to unknown port: 0x%X\n", Port);
-static VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, WORD Code)
+static VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, USHORT BopCode)
{
WORD StackSegment, StackPointer, CodeSegment, InstructionPointer;
BYTE IntNum;
{
WORD StackSegment, StackPointer, CodeSegment, InstructionPointer;
BYTE IntNum;
/* Get the stack */
Stack = (LPWORD)((ULONG_PTR)BaseAddress + TO_LINEAR(StackSegment, StackPointer));
/* Get the stack */
Stack = (LPWORD)((ULONG_PTR)BaseAddress + TO_LINEAR(StackSegment, StackPointer));
- if (Code == EMULATOR_INT_BOP)
+ if (BopCode == EMULATOR_INT_BOP)
{
/* Get the interrupt number */
IntNum = LOBYTE(Stack[STACK_INT_NUM]);
{
/* Get the interrupt number */
IntNum = LOBYTE(Stack[STACK_INT_NUM]);
-static BYTE WINAPI EmulatorIntAcknowledge(PFAST486_STATE State)
+static UCHAR WINAPI EmulatorIntAcknowledge(PFAST486_STATE State)
{
UNREFERENCED_PARAMETER(State);
{
UNREFERENCED_PARAMETER(State);
if (BaseAddress == NULL) return FALSE;
/* Set the callbacks */
if (BaseAddress == NULL) return FALSE;
/* Set the callbacks */
- EmulatorContext.MemReadCallback = (FAST486_MEM_READ_PROC)EmulatorReadMemory;
- EmulatorContext.MemWriteCallback = (FAST486_MEM_WRITE_PROC)EmulatorWriteMemory;
- EmulatorContext.IoReadCallback = (FAST486_IO_READ_PROC)EmulatorReadIo;
- EmulatorContext.IoWriteCallback = (FAST486_IO_WRITE_PROC)EmulatorWriteIo;
- EmulatorContext.BopCallback = EmulatorBiosOperation;
- EmulatorContext.IntAckCallback = EmulatorIntAcknowledge;
+ EmulatorContext.MemReadCallback = EmulatorReadMemory;
+ EmulatorContext.MemWriteCallback = EmulatorWriteMemory;
+ EmulatorContext.IoReadCallback = EmulatorReadIo;
+ EmulatorContext.IoWriteCallback = EmulatorWriteIo;
+ EmulatorContext.BopCallback = EmulatorBiosOperation;
+ EmulatorContext.IntAckCallback = EmulatorIntAcknowledge;
/* Reset the CPU */
Fast486Reset(&EmulatorContext);
/* Reset the CPU */
Fast486Reset(&EmulatorContext);