/*
* COPYRIGHT: GPL - See COPYING in the top level directory
* PROJECT: ReactOS Virtual DOS Machine
- * FILE: vidbios.c
- * PURPOSE: VDM Video BIOS Support Library
+ * FILE: subsystems/mvdm/ntvdm/bios/vidbios.c
+ * PURPOSE: VDM 32-bit Video BIOS Support Library
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
/* INCLUDES *******************************************************************/
+#include "ntvdm.h"
+
#define NDEBUG
+#include <debug.h>
+
+/* BIOS Version number and Copyright */
+#include <reactos/buildno.h>
+#include <reactos/version.h>
-#include "ntvdm.h"
#include "emulator.h"
#include "cpu/cpu.h"
#include "cpu/bop.h"
#include "memory.h"
#include "bios.h"
+#include "bios32/bios32p.h"
+#include "rom.h"
#include "bios32/vbe.h"
// #include "vidbios.h"
+#include "bios32/vidbios32.h"
#include "io.h"
#include "hardware/video/svga.h"
+/**/
+#include "../console/video.h"
+/**/
-/* DEFINES ********************************************************************/
-
-/* BOP Identifiers */
-#define BOP_VIDEO_INT 0x10
+/* PRIVATE VARIABLES **********************************************************/
-/* MACROS *********************************************************************/
+/*
+ * WARNING! For compatibility purposes the string "IBM" should be at C000:001E.
+ */
+static const CHAR BiosInfo[] =
+ "00000000000 Emulation of IBM VGA Compatible ROM\0"
+ "CL-GD5434 VGA BIOS Version 1.41 \r\n"
+ "Copyright (C) ReactOS Team 1996-"COPYRIGHT_YEAR"\r\n"
+ "The original CL-GD5434 card was created by Cirrus Logic, Inc.\r\n\0"
+ "BIOS Date: 06/17/13\0";
-//
-// These macros are defined for ease-of-use of some VGA I/O ports
-// whose addresses depend whether we are in Monochrome or Colour mode.
-//
-#define VGA_INSTAT1_READ Bda->CrtBasePort + 6 // VGA_INSTAT1_READ_MONO or VGA_INSTAT1_READ_COLOR
-#define VGA_CRTC_INDEX Bda->CrtBasePort // VGA_CRTC_INDEX_MONO or VGA_CRTC_INDEX_COLOR
-#define VGA_CRTC_DATA Bda->CrtBasePort + 1 // VGA_CRTC_DATA_MONO or VGA_CRTC_DATA_COLOR
+C_ASSERT(sizeof(BiosInfo)-1 <= 0xFF-0x05); // Ensures that we won't overflow on the Video Code
-/* PRIVATE VARIABLES **********************************************************/
/*
* VGA Register Configurations for BIOS Video Modes.
{
PVGA_REGISTERS VgaRegisters;
WORD PageSize;
+ WORD CharacterWidth;
WORD CharacterHeight;
// PCOLORREF Palette;
} VGA_MODE, *PVGA_MODE;
static CONST VGA_MODE VideoModes[BIOS_MAX_VIDEO_MODE + 1] =
{
- {&VideoMode_40x25_text, 0x0800, 16}, /* Mode 00h - 16 color (mono) */
- {&VideoMode_40x25_text, 0x0800, 16}, /* Mode 01h - 16 color */
- {&VideoMode_80x25_text, 0x1000, 16}, /* Mode 02h - 16 color (mono) */
- {&VideoMode_80x25_text, 0x1000, 16}, /* Mode 03h - 16 color */
- {&VideoMode_320x200_4color, 0x4000, 8}, /* Mode 04h - CGA 4 color */
- {&VideoMode_320x200_4color, 0x4000, 8}, /* Mode 05h - CGA same (m) (uses 3rd CGA palette) */
- {&VideoMode_640x200_2color, 0x4000, 8}, /* Mode 06h - CGA 640*200 2 color */
- {NULL, 0x1000, 0}, /* Mode 07h - MDA monochrome text 80*25 */
- {NULL, 0x0000, 0}, /* Mode 08h - PCjr */
- {NULL, 0x0000, 0}, /* Mode 09h - PCjr */
- {NULL, 0x0000, 0}, /* Mode 0Ah - PCjr */
- {NULL, 0x0000, 0}, /* Mode 0Bh - Reserved */
- {NULL, 0x0000, 0}, /* Mode 0Ch - Reserved */
- {&VideoMode_320x200_16color, 0x2000, 8}, /* Mode 0Dh - EGA 320*200 16 color */
- {&VideoMode_640x200_16color, 0x4000, 8}, /* Mode 0Eh - EGA 640*200 16 color */
- {NULL, 0x8000, 0}, /* Mode 0Fh - EGA 640*350 mono */
- {&VideoMode_640x350_16color, 0x8000, 14}, /* Mode 10h - EGA 640*350 HiRes 16 color */
- {&VideoMode_640x480_2color, 0xA000, 16}, /* Mode 11h - VGA 640*480 mono */
- {&VideoMode_640x480_16color, 0xA000, 16}, /* Mode 12h - VGA */
- {&VideoMode_320x200_256color, 0x2000, 8}, /* Mode 13h - VGA */
+ {&VideoMode_40x25_text, 0x0800, 9, 16}, /* Mode 00h - 16 color (mono) */
+ {&VideoMode_40x25_text, 0x0800, 9, 16}, /* Mode 01h - 16 color */
+ {&VideoMode_80x25_text, 0x1000, 9, 16}, /* Mode 02h - 16 color (mono) */
+ {&VideoMode_80x25_text, 0x1000, 9, 16}, /* Mode 03h - 16 color */
+ {&VideoMode_320x200_4color, 0x4000, 8, 8}, /* Mode 04h - CGA 4 color */
+ {&VideoMode_320x200_4color, 0x4000, 8, 8}, /* Mode 05h - CGA same (m) (uses 3rd CGA palette) */
+ {&VideoMode_640x200_2color, 0x4000, 8, 8}, /* Mode 06h - CGA 640*200 2 color */
+ {NULL, 0x1000, 1, 1}, /* Mode 07h - MDA monochrome text 80*25 */
+ {NULL, 0x0000, 1, 1}, /* Mode 08h - PCjr */
+ {NULL, 0x0000, 1, 1}, /* Mode 09h - PCjr */
+ {NULL, 0x0000, 1, 1}, /* Mode 0Ah - PCjr */
+ {NULL, 0x0000, 1, 1}, /* Mode 0Bh - Reserved */
+ {NULL, 0x0000, 1, 1}, /* Mode 0Ch - Reserved */
+ {&VideoMode_320x200_16color, 0x2000, 8, 8}, /* Mode 0Dh - EGA 320*200 16 color */
+ {&VideoMode_640x200_16color, 0x4000, 8, 8}, /* Mode 0Eh - EGA 640*200 16 color */
+ {NULL, 0x8000, 1, 1}, /* Mode 0Fh - EGA 640*350 mono */
+ {&VideoMode_640x350_16color, 0x8000, 8, 14}, /* Mode 10h - EGA 640*350 HiRes 16 color */
+ {&VideoMode_640x480_2color, 0xA000, 8, 16}, /* Mode 11h - VGA 640*480 mono */
+ {&VideoMode_640x480_16color, 0xA000, 8, 16}, /* Mode 12h - VGA */
+ {&VideoMode_320x200_256color, 0x2000, 8, 8}, /* Mode 13h - VGA */
};
#define IS_TEXT_MODE(ModeNumber) \
WORD WindowWidth, WindowHeight;
+ /* TODO: This function doesn't work in non-alphanumeric modes yet */
+ if (Bda->VideoMode > 3)
+ {
+ DPRINT1("VidBiosScrollWindow: not implemented for mode 0%Xh\n", Bda->VideoMode);
+ return FALSE;
+ }
+
/* Fixup the rectangle if needed */
Rectangle.Left = min(max(Rectangle.Left , 0), Bda->ScreenColumns - 1);
Rectangle.Right = min(max(Rectangle.Right , 0), Bda->ScreenColumns - 1);
/* Move text lines up */
for (i = Rectangle.Top + Amount; i <= Rectangle.Bottom; i++)
{
- EmulatorWriteMemory(&EmulatorContext,
- VideoAddress + ((i - Amount) * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD),
- REAL_TO_PHYS(VideoAddress + ( i * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD)),
- (Rectangle.Right - Rectangle.Left + 1) * sizeof(WORD));
+ EmulatorCopyMemory(&EmulatorContext,
+ VideoAddress + ((i - Amount) * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD),
+ VideoAddress + ( i * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD),
+ (Rectangle.Right - Rectangle.Left + 1) * sizeof(WORD));
}
/* Fill the bottom of the rectangle */
/* Move text lines down */
for (i = Rectangle.Bottom - Amount; i >= Rectangle.Top; i--)
{
- EmulatorWriteMemory(&EmulatorContext,
- VideoAddress + ((i + Amount) * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD),
- REAL_TO_PHYS(VideoAddress + ( i * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD)),
- (Rectangle.Right - Rectangle.Left + 1) * sizeof(WORD));
+ EmulatorCopyMemory(&EmulatorContext,
+ VideoAddress + ((i + Amount) * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD),
+ VideoAddress + ( i * Bda->ScreenColumns + Rectangle.Left) * sizeof(WORD),
+ (Rectangle.Right - Rectangle.Left + 1) * sizeof(WORD));
}
/* Fill the top of the rectangle */
/* Move text lines left */
for (i = Rectangle.Top; i <= Rectangle.Bottom; i++)
{
- EmulatorWriteMemory(&EmulatorContext,
- VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left ) * sizeof(WORD),
- REAL_TO_PHYS(VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left + Amount) * sizeof(WORD)),
- (Rectangle.Right - Rectangle.Left - Amount + 1) * sizeof(WORD));
+ EmulatorCopyMemory(&EmulatorContext,
+ VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left ) * sizeof(WORD),
+ VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left + Amount) * sizeof(WORD),
+ (Rectangle.Right - Rectangle.Left - Amount + 1) * sizeof(WORD));
}
/* Fill the right of the rectangle */
case SCROLL_RIGHT:
{
+ INT Right;
+
/* Move text lines right */
for (i = Rectangle.Top; i <= Rectangle.Bottom; i++)
{
- EmulatorWriteMemory(&EmulatorContext,
- VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left + Amount) * sizeof(WORD),
- REAL_TO_PHYS(VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left ) * sizeof(WORD)),
- (Rectangle.Right - Rectangle.Left - Amount + 1) * sizeof(WORD));
+ EmulatorCopyMemory(&EmulatorContext,
+ VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left + Amount) * sizeof(WORD),
+ VideoAddress + (i * Bda->ScreenColumns + Rectangle.Left ) * sizeof(WORD),
+ (Rectangle.Right - Rectangle.Left - Amount + 1) * sizeof(WORD));
}
/* Fill the left of the rectangle */
+ Right = Rectangle.Left + Amount - 1;
for (i = Rectangle.Top; i <= Rectangle.Bottom; i++)
{
- INT Right = Rectangle.Left + Amount - 1;
for (j = Rectangle.Left; j <= Right; j++)
{
EmulatorWriteMemory(&EmulatorContext,
IOWriteB(VGA_CRTC_DATA , LOBYTE(CursorStartEnd));
}
-VOID VidBiosSyncCursorPosition(VOID)
+static VOID VidBiosSyncCursorPosition(VOID)
{
BYTE Row, Column;
BYTE Low, High;
- SHORT ScreenColumns = VgaGetDisplayResolution().X;
+ SHORT ScreenColumns = Bda->ScreenColumns;
WORD Offset;
/* Get the cursor position */
/* Retrieve the real mode number and check its validity */
ModeNumber &= 0x7F;
// if (ModeNumber >= ARRAYSIZE(VideoModes))
- if (ModeNumber > BIOS_MAX_VIDEO_MODE)
- {
- DPRINT1("VidBiosSetVideoMode -- Mode %02Xh invalid\n", ModeNumber);
- return FALSE;
- }
DPRINT1("Switching to mode %02Xh (%02Xh) %s clearing the screen; VgaRegisters = 0x%p\n",
ModeNumber, OrgModeNumber, (DoNotClear ? "without" : "and"), VideoModes[ModeNumber].VgaRegisters);
+ if (ModeNumber > BIOS_MAX_VIDEO_MODE)
+ {
+ /* This could be an extended video mode, so call the VBE BIOS */
+ return VbeSetExtendedVideoMode(ModeNumber);
+ }
+
if (!VgaSetRegisters(VideoModes[ModeNumber].VgaRegisters)) return FALSE;
+ if (VbeInitialized && Bda->VideoMode > BIOS_MAX_VIDEO_MODE)
+ {
+ /*
+ * Since we're switching from an extended video mode to a standard VGA
+ * mode, tell the VBE BIOS to reset the extended registers.
+ */
+ VbeResetExtendedRegisters();
+ }
VgaChangePalette(ModeNumber);
/* Update the screen size */
Resolution = VgaGetDisplayResolution();
+ // This could be simplified if the VGA helper always returned the resolution
+ // in number of pixels, instead of in number of cells for text-modes only...
+ if (!IS_TEXT_MODE(ModeNumber))
+ {
+ Resolution.X /= VideoModes[ModeNumber].CharacterWidth ;
+ Resolution.Y /= VideoModes[ModeNumber].CharacterHeight;
+ }
Bda->ScreenColumns = Resolution.X;
Bda->ScreenRows = Resolution.Y - 1;
- /* Adjust the number of columns for graphics modes */
- if (!IS_TEXT_MODE(ModeNumber)) Bda->ScreenColumns >>= 3;
-
/* Update the current font */
Bda->CharacterHeight = VideoModes[ModeNumber].CharacterHeight;
switch (Bda->CharacterHeight)
* but we update the cursor position on the VGA side).
*/
VidBiosGetCursorPosition(&Row, &Column, PageNumber);
- VidBiosSetCursorPosition(Row, Column, PageNumber);
+ VidBiosSetCursorPosition( Row, Column, PageNumber);
return TRUE;
}
WORD i, j;
PUCHAR Font = (PUCHAR)FAR_POINTER(((PULONG)BaseAddress)[0x43]);
PUCHAR Glyph = &Font[LOBYTE(CharData) * Bda->CharacterHeight];
- BYTE PixelBuffer[8];
+ BYTE PixelBuffer[8]; // 8 == CharacterWidth
for (i = 0; i < Bda->CharacterHeight; i++)
{
- for (j = 0; j < 8; j++)
+ for (j = 0; j < ARRAYSIZE(PixelBuffer); j++)
{
PixelBuffer[j] = (Glyph[i] & (1 << (7 - j))) ? HIBYTE(CharData) : 0;
}
EmulatorWriteMemory(&EmulatorContext,
TO_LINEAR(GRAPHICS_VIDEO_SEG,
((Row * Bda->CharacterHeight + i)
- * Bda->ScreenColumns + Column) << 3),
+ * Bda->ScreenColumns + Column) * 8),
(LPVOID)PixelBuffer,
sizeof(PixelBuffer));
}
/* Set the overscan register */
// VgaSetSinglePaletteRegister(VGA_AC_OVERSCAN_REG, Buffer[VGA_AC_PAL_F_REG + 1]);
+ IOReadB(VGA_INSTAT1_READ);
IOWriteB(VGA_AC_INDEX, VGA_AC_OVERSCAN_REG);
IOWriteB(VGA_AC_WRITE, Buffer[VGA_AC_PAL_F_REG + 1]);
{
/* Read the old AC mode control register value */
BYTE VgaAcControlReg;
+
+ IOReadB(VGA_INSTAT1_READ);
IOWriteB(VGA_AC_INDEX, VGA_AC_CONTROL_REG);
VgaAcControlReg = IOReadB(VGA_AC_READ);
Bda->CrtModeControl &= ~(1 << 5);
}
+ IOReadB(VGA_INSTAT1_READ);
IOWriteB(VGA_AC_INDEX, VGA_AC_CONTROL_REG);
IOWriteB(VGA_AC_WRITE, VgaAcControlReg);
}
/* Get the overscan register */
+ IOReadB(VGA_INSTAT1_READ);
IOWriteB(VGA_AC_INDEX, VGA_AC_OVERSCAN_REG);
Buffer[VGA_AC_PAL_F_REG + 1] = IOReadB(VGA_AC_READ);
break;
}
+ /* Set Video DAC Color Page */
+ case 0x13:
+ {
+ if (getBL() == 0)
+ {
+ /* Set the highest bit of the AC Mode Control register to BH */
+ IOReadB(VGA_INSTAT1_READ);
+ IOWriteB(VGA_AC_INDEX, VGA_AC_CONTROL_REG);
+ IOWriteB(VGA_AC_WRITE, (IOReadB(VGA_AC_READ) & 0x7F) | (getBH() << 7));
+ }
+ else if (getBL() == 1)
+ {
+ /* Set the AC Color Select register to BH */
+ IOReadB(VGA_INSTAT1_READ);
+ IOWriteB(VGA_AC_INDEX, VGA_AC_COLOR_SEL_REG);
+ IOWriteB(VGA_AC_WRITE, getBH());
+ }
+ else
+ {
+ DPRINT1("BIOS Palette Control Sub-sub-command BL = 0x%02X INVALID\n", getBL());
+ }
+
+ break;
+ }
+
/* Get Individual DAC Register */
case 0x15:
{
Attached = TRUE;
}
+ /* Refresh display */
VgaRefreshDisplay();
VidBiosSyncCursorPosition();
}
VOID VidBiosDetachFromConsole(VOID)
{
- /* Perform another screen refresh */
+ if (!Attached) return;
+
+ /* Refresh display */
VgaRefreshDisplay();
/* Detach from the console */
- VgaDetachFromConsole(FALSE);
+ VgaDetachFromConsole();
Attached = FALSE;
}
-BOOLEAN VidBiosInitialize(VOID)
+VOID VidBiosPost(VOID)
{
+ /*
+ * Initialize VGA BIOS32 RAM dynamic data
+ */
+
/* Some vectors are in fact addresses to tables */
((PULONG)BaseAddress)[0x1D] = (ULONG)NULL; // Video Parameter Tables
// Far pointer to the 8x8 graphics font for the 8x8 characters 80h-FFh
((PULONG)BaseAddress)[0x42] = (ULONG)NULL; // Relocated Default INT 10h Video Services
((PULONG)BaseAddress)[0x6D] = (ULONG)NULL; // Video BIOS Entry Point
- /* Initialize the VGA static function table */
- VgaStaticFuncTable = SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, VIDEO_STATE_INFO_OFFSET);
- RtlZeroMemory(VgaStaticFuncTable, sizeof(*VgaStaticFuncTable));
- VgaStaticFuncTable->SupportedModes[0] = 0xFF; // Modes 0x00 to 0x07 supported
- VgaStaticFuncTable->SupportedModes[1] = 0xFF; // Modes 0x08 to 0x0F supported
- VgaStaticFuncTable->SupportedModes[2] = 0x0F; // Modes 0x10 to 0x13 supported
- VgaStaticFuncTable->SupportedScanlines = 0x07; // Scanlines 200, 350 and 400 supported
- VgaStaticFuncTable->TextCharBlocksNumber = 0;
- VgaStaticFuncTable->MaxActiveTextCharBlocksNumber = 0;
- VgaStaticFuncTable->VGAFuncSupportFlags = 0x0CFD; // See: http://www.ctyme.com/intr/rb-0221.htm#Table46
- VgaStaticFuncTable->VGASavePtrFuncFlags = 0x18; // See: http://www.ctyme.com/intr/rb-0221.htm#Table47
-
- /* Fill the font tables */
- RtlMoveMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, FONT_8x8_OFFSET),
- Font8x8, sizeof(Font8x8));
- RtlMoveMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, FONT_8x16_OFFSET),
- Font8x16, sizeof(Font8x16));
- RtlMoveMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, FONT_8x14_OFFSET),
- Font8x14, sizeof(Font8x14));
-
//
// FIXME: At the moment we always set a VGA mode. In the future,
// we should set this mode **only** when:
/* Synchronize our cursor position with VGA */
VidBiosSyncCursorPosition();
- /* Register the BIOS support BOPs */
- RegisterBop(BOP_VIDEO_INT, VidBiosVideoService);
+ /* Register the BIOS 32-bit Interrupts */
+ RegisterBiosInt32(BIOS_VIDEO_INTERRUPT, VidBiosVideoService);
+
+ /* Vectors that should be implemented */
+ RegisterBiosInt32(0x42, NULL); // Relocated Default INT 10h Video Services
+ RegisterBiosInt32(0x6D, NULL); // Video BIOS Entry Point
/* Initialize VBE */
VbeInitialized = VbeInitialize();
if (!VbeInitialized) DPRINT1("Couldn't initialize VBE!\n");
+}
+
+BOOLEAN VidBiosInitialize(VOID)
+{
+ UCHAR Checksum;
+
+ /*
+ * Initialize VGA BIOS32 static data
+ */
+
+ /* This is a ROM of size 'VIDEO_BIOS_ROM_SIZE' */
+ *(PWORD)(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, 0x0000)) = 0xAA55;
+ *(PBYTE)(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, 0x0002)) = VIDEO_BIOS_ROM_SIZE / 512; // Size in blocks of 512 bytes
+
+ /* Bootstrap code */
+ *(PWORD)(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, 0x0003)) = 0x90CB; // retf, nop
+ // RtlCopyMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, 0xFFF0), Bootstrap, sizeof(Bootstrap));
+
+ /* Video BIOS Information */
+ RtlCopyMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, 0x0005), BiosInfo, sizeof(BiosInfo)-1);
+
+ /* Initialize the VGA static function table */
+ VgaStaticFuncTable = SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, VIDEO_STATE_INFO_OFFSET);
+ RtlZeroMemory(VgaStaticFuncTable, sizeof(*VgaStaticFuncTable));
+ VgaStaticFuncTable->SupportedModes[0] = 0xFF; // Modes 0x00 to 0x07 supported
+ VgaStaticFuncTable->SupportedModes[1] = 0xFF; // Modes 0x08 to 0x0F supported
+ VgaStaticFuncTable->SupportedModes[2] = 0x0F; // Modes 0x10 to 0x13 supported
+ VgaStaticFuncTable->SupportedScanlines = 0x07; // Scanlines 200, 350 and 400 supported
+ VgaStaticFuncTable->TextCharBlocksNumber = 0;
+ VgaStaticFuncTable->MaxActiveTextCharBlocksNumber = 0;
+ VgaStaticFuncTable->VGAFuncSupportFlags = 0x0CFD; // See: http://www.ctyme.com/intr/rb-0221.htm#Table46
+ VgaStaticFuncTable->VGASavePtrFuncFlags = 0x18; // See: http://www.ctyme.com/intr/rb-0221.htm#Table47
+
+ /* Fill the font tables */
+ RtlMoveMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, FONT_8x8_OFFSET),
+ Font8x8, sizeof(Font8x8));
+ RtlMoveMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, FONT_8x16_OFFSET),
+ Font8x16, sizeof(Font8x16));
+ RtlMoveMemory(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, FONT_8x14_OFFSET),
+ Font8x14, sizeof(Font8x14));
+
+ /* Make another copy of the lower half of the 8x8 font at F000:FA6E for compatibility */
+ RtlMoveMemory(SEG_OFF_TO_PTR(BIOS_SEGMENT, FONT_8x8_COMPAT_OFFSET), Font8x8, sizeof(Font8x8) / 2);
+
+ VidBios32Initialize();
+
+ /* Compute the ROM checksum and store it */
+ *(PBYTE)(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, VIDEO_BIOS_ROM_SIZE - 1)) = 0x00;
+ Checksum = CalcRomChecksum(TO_LINEAR(VIDEO_BIOS_DATA_SEG, 0x0000), VIDEO_BIOS_ROM_SIZE);
+ *(PBYTE)(SEG_OFF_TO_PTR(VIDEO_BIOS_DATA_SEG, VIDEO_BIOS_ROM_SIZE - 1)) = (0xFF - Checksum + 1) & 0xFF;
+
+ WriteProtectRom((PVOID)TO_LINEAR(VIDEO_BIOS_DATA_SEG, 0x0000),
+ VIDEO_BIOS_ROM_SIZE);
return TRUE;
}