41d9510294384f7046338a2428ae0288a9c05f7b
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
5 * PURPOSE: BIOS Operation Handlers
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10 /* INCLUDES *******************************************************************/
23 LPCWSTR ExceptionName
[] =
30 L
"Bound Range Exceeded",
35 VOID WINAPI
Exception(BYTE ExceptionNumber
, LPWORD Stack
)
37 WORD CodeSegment
, InstructionPointer
;
39 ASSERT(ExceptionNumber
< 8);
42 InstructionPointer
= Stack
[STACK_IP
];
43 CodeSegment
= Stack
[STACK_CS
];
45 /* Display a message to the user */
46 DisplayMessage(L
"Exception: %s occured at %04X:%04X",
47 ExceptionName
[ExceptionNumber
],
56 // VOID WINAPI IrqDispatch(BYTE IrqNumber, LPWORD Stack)
58 // /* Check if this was an PIC IRQ */
59 // if (IntNum >= BIOS_PIC_MASTER_INT && IntNum < BIOS_PIC_MASTER_INT + 8)
61 // /* It was an IRQ from the master PIC */
62 // BiosHandleIrq(IntNum - BIOS_PIC_MASTER_INT, Stack);
64 // else if (IntNum >= BIOS_PIC_SLAVE_INT && IntNum < BIOS_PIC_SLAVE_INT + 8)
66 // /* It was an IRQ from the slave PIC */
67 // BiosHandleIrq(IntNum - BIOS_PIC_SLAVE_INT + 8, Stack);
73 // VOID WINAPI BiosInt(BYTE IntNumber, LPWORD Stack)
77 VOID WINAPI
IntDispatch(LPWORD Stack
)
81 /* Get the interrupt number */
82 IntNum
= LOBYTE(Stack
[STACK_INT_NUM
]);
84 /* Check if this was an exception */
87 Exception(IntNum
, Stack
);
91 /* Check if this was an PIC IRQ */
92 if (IntNum
>= BIOS_PIC_MASTER_INT
&& IntNum
< BIOS_PIC_MASTER_INT
+ 8)
94 /* It was an IRQ from the master PIC */
95 BiosHandleIrq(IntNum
- BIOS_PIC_MASTER_INT
, Stack
);
98 else if (IntNum
>= BIOS_PIC_SLAVE_INT
&& IntNum
< BIOS_PIC_SLAVE_INT
+ 8)
100 /* It was an IRQ from the slave PIC */
101 BiosHandleIrq(IntNum
- BIOS_PIC_SLAVE_INT
+ 8, Stack
);
107 case BIOS_VIDEO_INTERRUPT
:
109 /* This is the video BIOS interrupt, call the BIOS */
110 BiosVideoService(Stack
);
113 case BIOS_EQUIPMENT_INTERRUPT
:
115 /* This is the BIOS "get equipment" command, call the BIOS */
116 BiosEquipmentService(Stack
);
119 case BIOS_KBD_INTERRUPT
:
121 /* This is the keyboard BIOS interrupt, call the BIOS */
122 BiosKeyboardService(Stack
);
125 case BIOS_TIME_INTERRUPT
:
127 /* This is the time BIOS interrupt, call the BIOS */
128 BiosTimeService(Stack
);
131 case BIOS_SYS_TIMER_INTERRUPT
:
133 /* BIOS timer update */
134 BiosSystemTimerInterrupt(Stack
);
149 DosBreakInterrupt(Stack
);
154 DPRINT1("Unhandled interrupt: 0x%02X\n", IntNum
);
160 VOID WINAPI
ControlBop(LPWORD Stack
)