ReactOS  0.4.14-dev-317-g96040ec
bop.c
Go to the documentation of this file.
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 #include "ntvdm.h"
13 
14 #define NDEBUG
15 #include <debug.h>
16 
17 #include "emulator.h"
18 #include "bop.h"
19 
20 /* PRIVATE VARIABLES **********************************************************/
21 
22 /*
23  * This is the list of registered BOP handlers.
24  */
26 
27 /* PUBLIC FUNCTIONS ***********************************************************/
28 
29 VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
30 {
31  BopProc[BopCode] = BopHandler;
32 }
33 
34 VOID FASTCALL EmulatorBiosOperation(PFAST486_STATE State, UCHAR BopCode)
35 {
36  WORD StackSegment, StackPointer;
37  LPWORD Stack;
38 
39  /* Get the SS:SP */
40  StackSegment = State->SegmentRegs[FAST486_REG_SS].Selector;
41  StackPointer = State->GeneralRegs[FAST486_REG_ESP].LowWord;
42 
43  /* Get the stack */
44  Stack = (LPWORD)SEG_OFF_TO_PTR(StackSegment, StackPointer);
45 
46  /* Call the BOP handler */
47  if (BopProc[BopCode] != NULL)
48  BopProc[BopCode](Stack);
49  else
50  DPRINT1("Invalid BOP code: 0x%02X\n", BopCode);
51 }
52 
53 /* EOF */
VOID(WINAPI * EMULATOR_BOP_PROC)(LPWORD Stack)
Definition: bop.h:21
VOID FASTCALL EmulatorBiosOperation(PFAST486_STATE State, UCHAR BopCode)
Definition: bop.c:34
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
Definition: bop.c:29
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:28
#define FASTCALL
Definition: nt_native.h:50
#define EMULATOR_MAX_BOP_NUM
Definition: bop.h:17
smooth NULL
Definition: ftsmooth.c:416
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned char UCHAR
Definition: xmlstorage.h:181
static EMULATOR_BOP_PROC BopProc[EMULATOR_MAX_BOP_NUM]
Definition: bop.c:25
unsigned char BYTE
Definition: mem.h:68
uint16_t * LPWORD
Definition: typedefs.h:54
#define DPRINT1
Definition: precomp.h:8