/* INCLUDES *******************************************************************/
-#include "ntvdm.h"
-#include <softx86/softx86.h>
-#include <softx86/softx87.h>
+#include "emulator.h"
+#include "bios.h"
+#include "dos.h"
+#include "pic.h"
+#include "ps2.h"
+#include "timer.h"
-softx86_ctx EmulatorContext;
-softx87_ctx FpuEmulatorContext;
+/* PRIVATE VARIABLES **********************************************************/
+
+static softx86_ctx EmulatorContext;
+static softx87_ctx FpuEmulatorContext;
static BOOLEAN A20Line = FALSE;
+/* PRIVATE FUNCTIONS **********************************************************/
+
static VOID EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size)
{
/* If the A20 line is disabled, mask bit 20 */
{
/* It was an IRQ from the master PIC */
BiosHandleIrq(IntNum - BIOS_PIC_MASTER_INT);
+ return;
}
else if (IntNum >= BIOS_PIC_SLAVE_INT && IntNum < BIOS_PIC_SLAVE_INT + 8)
{
/* It was an IRQ from the slave PIC */
BiosHandleIrq(IntNum - BIOS_PIC_SLAVE_INT + 8);
+ return;
}
switch (IntNum)
{
- case VIDEO_BIOS_INTERRUPT:
+ case BIOS_VIDEO_INTERRUPT:
{
/* This is the video BIOS interrupt, call the BIOS */
BiosVideoService();
break;
}
+ case BIOS_EQUIPMENT_INTERRUPT:
+ {
+ /* This is the BIOS "get equipment" command, call the BIOS */
+ BiosEquipmentService();
+ break;
+ }
+ case BIOS_KBD_INTERRUPT:
+ {
+ /* This is the keyboard BIOS interrupt, call the BIOS */
+ BiosKeyboardService();
+ break;
+ }
+ case BIOS_TIME_INTERRUPT:
+ {
+ /* This is the time BIOS interrupt, call the BIOS */
+ BiosTimeService();
+ break;
+ }
case 0x20:
{
DosInt20h(CodeSegment);
DosBreakInterrupt();
break;
}
+ default:
+ {
+ DPRINT1("Unhandled interrupt: 0x%02X\n", IntNum);
+ break;
+ }
}
}
}
BOOLEAN EmulatorInitialize()
{
/* Allocate memory for the 16-bit address space */
- BaseAddress = HeapAlloc(GetProcessHeap(), 0, MAX_ADDRESS);
+ BaseAddress = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_ADDRESS);
if (BaseAddress == NULL) return FALSE;
/* Initialize the softx86 CPU emulator */