#define NDEBUG
#include "ntvdm.h"
+#include "emulator.h"
+#include "cpu/bop.h"
#include "int32.h"
#include "vidbios32.h"
#include <bios/vidbios.h>
#include "bios32p.h"
+/* DEFINES ********************************************************************/
+
+/* BOP Identifiers */
+#define BOP_VIDEO_INT 0x10
+
/* PUBLIC FUNCTIONS ***********************************************************/
-BOOLEAN VidBios32Initialize(VOID)
+extern VOID WINAPI VidBiosVideoService(LPWORD Stack);
+static VOID WINAPI VidBiosINT(LPWORD Stack)
{
- /* Initialize the common Video BIOS Support Library */
- if (!VidBiosInitialize()) return FALSE;
+ /*
+ * Set up a false stack to hardwire the BOP function (that can directly
+ * manipulate CPU registers) to the 32-bit interrupt function (which uses
+ * the stack to be able to modify the original CS:IP and FLAGS).
+ *
+ * See int32.h stack codes.
+ */
+ WORD EmuStack[4];
+ DWORD Flags = getEFLAGS();
+
+ DPRINT1("Calling BOP VidBiosINT\n");
- /* Register the BIOS 32-bit Interrupts */
- RegisterBiosInt32(BIOS_VIDEO_INTERRUPT, VidBiosVideoService);
+ EmuStack[STACK_FLAGS] = LOWORD(Flags);
+ EmuStack[STACK_CS] = getCS();
+ EmuStack[STACK_IP] = getIP();
+ EmuStack[STACK_INT_NUM] = BOP_VIDEO_INT;
- /* Vectors that should be implemented */
- RegisterBiosInt32(0x42, NULL); // Relocated Default INT 10h Video Services
- RegisterBiosInt32(0x6D, NULL); // Video BIOS Entry Point
+ VidBiosVideoService(EmuStack);
+ setIP(EmuStack[STACK_IP]);
+ setCS(EmuStack[STACK_CS]);
+ setEFLAGS(MAKELONG(EmuStack[STACK_FLAGS], HIWORD(Flags)));
+}
+
+BOOLEAN VidBios32Initialize(VOID)
+{
+ /* Register the BIOS support BOPs */
+ RegisterBop(BOP_VIDEO_INT, VidBiosINT);
return TRUE;
}
VOID VidBios32Cleanup(VOID)
{
- /* Cleanup the common Video BIOS Support Library */
- VidBiosCleanup();
+ /* Unregister the BIOS support BOPs */
+ RegisterBop(BOP_VIDEO_INT, NULL);
}
/* EOF */