[BASESRV][NTVDM][TESTVDD] Improve the FILE header section. Brought to you by Adam...
[reactos.git] / reactos / subsystems / mvdm / ntvdm / cpu / bop.c
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: subsystems/mvdm/ntvdm/cpu/bop.c
5 * PURPOSE: BIOS Operation Handlers
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10 /* INCLUDES *******************************************************************/
11
12 #define NDEBUG
13
14 #include "ntvdm.h"
15 #include "emulator.h"
16 #include "bop.h"
17
18 /* PRIVATE VARIABLES **********************************************************/
19
20 /*
21 * This is the list of registered BOP handlers.
22 */
23 static EMULATOR_BOP_PROC BopProc[EMULATOR_MAX_BOP_NUM] = { NULL };
24
25 /* PUBLIC FUNCTIONS ***********************************************************/
26
27 VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
28 {
29 BopProc[BopCode] = BopHandler;
30 }
31
32 VOID FASTCALL EmulatorBiosOperation(PFAST486_STATE State, UCHAR BopCode)
33 {
34 WORD StackSegment, StackPointer;
35 LPWORD Stack;
36
37 /* Get the SS:SP */
38 StackSegment = State->SegmentRegs[FAST486_REG_SS].Selector;
39 StackPointer = State->GeneralRegs[FAST486_REG_ESP].LowWord;
40
41 /* Get the stack */
42 Stack = (LPWORD)SEG_OFF_TO_PTR(StackSegment, StackPointer);
43
44 /* Call the BOP handler */
45 if (BopProc[BopCode] != NULL)
46 BopProc[BopCode](Stack);
47 else
48 DPRINT1("Invalid BOP code: 0x%02X\n", BopCode);
49 }
50
51 /* EOF */