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 */ 25 static EMULATOR_BOP_PROC BopProc[EMULATOR_MAX_BOP_NUM] = { NULL }; 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 */ 54