2013-11-01 00:01:07 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: GPL - See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Virtual DOS Machine
|
|
|
|
* FILE: bop.c
|
|
|
|
* PURPOSE: BIOS Operation Handlers
|
|
|
|
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
|
|
|
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *******************************************************************/
|
|
|
|
|
2014-10-02 00:03:55 +00:00
|
|
|
#define NDEBUG
|
2013-11-01 00:01:07 +00:00
|
|
|
|
|
|
|
#include "emulator.h"
|
2013-11-01 02:28:47 +00:00
|
|
|
#include "bop.h"
|
2013-11-09 22:15:40 +00:00
|
|
|
|
2013-11-09 23:01:11 +00:00
|
|
|
/* PRIVATE VARIABLES **********************************************************/
|
2013-11-01 00:01:07 +00:00
|
|
|
|
2013-11-09 22:15:40 +00:00
|
|
|
/*
|
|
|
|
* This is the list of registered BOP handlers.
|
|
|
|
*/
|
2014-05-19 01:12:25 +00:00
|
|
|
static EMULATOR_BOP_PROC BopProc[EMULATOR_MAX_BOP_NUM] = { NULL };
|
2013-11-01 02:28:47 +00:00
|
|
|
|
2013-11-09 23:01:11 +00:00
|
|
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
2013-11-01 00:01:07 +00:00
|
|
|
|
2013-12-23 18:04:32 +00:00
|
|
|
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
|
2013-11-01 00:01:07 +00:00
|
|
|
{
|
2013-12-15 16:30:28 +00:00
|
|
|
BopProc[BopCode] = BopHandler;
|
2013-11-09 22:15:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, UCHAR BopCode)
|
|
|
|
{
|
|
|
|
WORD StackSegment, StackPointer;
|
|
|
|
LPWORD Stack;
|
|
|
|
|
|
|
|
/* Get the SS:SP */
|
|
|
|
StackSegment = State->SegmentRegs[FAST486_REG_SS].Selector;
|
|
|
|
StackPointer = State->GeneralRegs[FAST486_REG_ESP].LowWord;
|
|
|
|
|
|
|
|
/* Get the stack */
|
|
|
|
Stack = (LPWORD)SEG_OFF_TO_PTR(StackSegment, StackPointer);
|
|
|
|
|
|
|
|
/* Call the BOP handler */
|
|
|
|
if (BopProc[BopCode] != NULL)
|
|
|
|
BopProc[BopCode](Stack);
|
|
|
|
else
|
2014-10-02 00:03:55 +00:00
|
|
|
DPRINT1("Invalid BOP code: 0x%02X\n", BopCode);
|
2013-11-01 00:01:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|