Author: hbelusca
Date: Sat Nov 15 16:14:04 2014
New Revision: 65414
URL:
http://svn.reactos.org/svn/reactos?rev=65414&view=rev
Log:
[NTVDM]: Fix various little things in the video BIOS (and fix some video mode registers).
Modified:
trunk/reactos/subsystems/ntvdm/bios/vidbios.c
Modified: trunk/reactos/subsystems/ntvdm/bios/vidbios.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/bios/vidb…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/bios/vidbios.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/bios/vidbios.c [iso-8859-1] Sat Nov 15 16:14:04 2014
@@ -39,8 +39,8 @@
/* PRIVATE VARIABLES **********************************************************/
/*
- * VGA Register Configurations for BIOS Video Modes
- * The configurations come from DOSBox.
+ * VGA Register Configurations for BIOS Video Modes.
+ * The configurations were checked against SeaBIOS VGA BIOS.
*/
static VGA_REGISTERS VideoMode_40x25_text =
{
@@ -48,7 +48,7 @@
0x67,
/* Sequencer Registers */
- {0x00, 0x08, 0x03, 0x00, 0x07},
+ {0x00, 0x08, 0x03, 0x00, 0x02},
/* CRTC Registers */
{0x2D, 0x27, 0x28, 0x90, 0x2B, 0xA0, 0xBF, 0x1F, 0x00, 0x4F, 0x0D, 0x0E,
@@ -69,7 +69,7 @@
0x67,
/* Sequencer Registers */
- {0x00, 0x00, 0x03, 0x00, 0x07},
+ {0x00, 0x00, 0x03, 0x00, 0x02},
/* CRTC Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00, 0x4F, 0x0D, 0x0E,
@@ -102,7 +102,7 @@
/* AC Registers */
{0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x0F, 0x00, 0x00}
+ 0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x03, 0x00, 0x00}
};
static VGA_REGISTERS VideoMode_640x200_2color =
@@ -111,7 +111,7 @@
0x63,
/* Sequencer Registers */
- {0x00, 0x09, 0x0F, 0x00, 0x02},
+ {0x00, 0x01, 0x01, 0x00, 0x02},
/* CRTC Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0xBF, 0x1F, 0x00, 0xC1, 0x00, 0x00,
@@ -132,7 +132,7 @@
0x63,
/* Sequencer Registers */
- {0x00, 0x09, 0x0F, 0x00, 0x02},
+ {0x00, 0x09, 0x0F, 0x00, 0x06},
/* CRTC Registers */
{0x2D, 0x27, 0x28, 0x90, 0x2B, 0x80, 0xBF, 0x1F, 0x00, 0xC0, 0x00, 0x00,
@@ -143,8 +143,6 @@
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0F, 0xFF},
/* AC Registers */
-// {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
-// 0x3C, 0x3D, 0x3E, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00}
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x0F, 0x00, 0x00}
};
@@ -155,7 +153,7 @@
0x63,
/* Sequencer Registers */
- {0x00, 0x01, 0x0F, 0x00, 0x02},
+ {0x00, 0x01, 0x0F, 0x00, 0x06},
/* CRTC Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0xBF, 0x1F, 0x00, 0xC0, 0x00, 0x00,
@@ -166,8 +164,6 @@
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0F, 0xFF},
/* AC Registers */
-// {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
-// 0x3C, 0x3D, 0x3E, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00}
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x0F, 0x00, 0x00}
};
@@ -178,7 +174,7 @@
0xA3,
/* Sequencer Registers */
- {0x00, 0x01, 0x0F, 0x00, 0x02},
+ {0x00, 0x01, 0x0F, 0x00, 0x06},
/* CRTC Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0xBF, 0x1F, 0x00, 0x40, 0x00, 0x00,
@@ -199,7 +195,7 @@
0xE3,
/* Sequencer Registers */
- {0x00, 0x01, 0x0F, 0x00, 0x02},
+ {0x00, 0x01, 0x0F, 0x00, 0x06},
/* CRTC Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, 0x00, 0x40, 0x00, 0x00,
@@ -210,8 +206,10 @@
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0F, 0xFF},
/* AC Registers */
- {0x00, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00}
+// {0x00, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+// 0x3F, 0x3F, 0x3F, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00}
+ {0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F,
+ 0x00, 0x3F, 0x00, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00}
};
static VGA_REGISTERS VideoMode_640x480_16color =
@@ -220,7 +218,7 @@
0xE3,
/* Sequencer Registers */
- {0x00, 0x01, 0x0F, 0x00, 0x02},
+ {0x00, 0x01, 0x0F, 0x00, 0x06},
/* CRTC Registers */
{0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, 0x00, 0x40, 0x00, 0x00,
@@ -2287,7 +2285,7 @@
VidBiosSetCursorPosition(Row, Column, Bda->VideoPage);
}
-BYTE VidBiosGetVideoMode(VOID)
+static BYTE VidBiosGetVideoMode(VOID)
{
/* Bit 7 of VideoMode is determined by bit 7 of VGAOptions */
return Bda->VideoMode | (Bda->VGAOptions & 0x80);
@@ -2343,6 +2341,7 @@
/* 256 KB Video RAM; set bit 7 if we do not clear the screen */
Bda->VGAOptions = 0x60 | (DoNotClear ? 0x80 : 0x00);
+ Bda->VGASwitches = 0xF9; /* High-resolution */
/* Set the start address in the CRTC */
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_START_ADDR_LOW_REG);
@@ -2362,6 +2361,8 @@
/* Set the cursor position for each page */
for (Page = 0; Page < BIOS_MAX_PAGES; ++Page)
VidBiosSetCursorPosition(0, 0, Page);
+
+ // FIXME: We need to reset the fonts and the font vectors. (INT 1Fh and 43h).
/* Refresh display */
VgaRefreshDisplay();
@@ -2518,13 +2519,15 @@
/* Set Text-Mode Cursor Shape */
case 0x01:
{
+ WORD CursorStartEnd = getCX();
+
/* Update the BDA */
- Bda->CursorStartLine = getCH();
- Bda->CursorEndLine = getCL();
+ Bda->CursorStartLine = HIBYTE(CursorStartEnd) & 0x1F;
+ Bda->CursorEndLine = LOBYTE(CursorStartEnd) & 0x1F;
/* Modify the CRTC registers */
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_CURSOR_START_REG);
- IOWriteB(VGA_CRTC_DATA , Bda->CursorStartLine);
+ IOWriteB(VGA_CRTC_DATA , HIBYTE(CursorStartEnd));
IOWriteB(VGA_CRTC_INDEX, VGA_CRTC_CURSOR_END_REG);
IOWriteB(VGA_CRTC_DATA , Bda->CursorEndLine);
@@ -3139,10 +3142,6 @@
/* Write the default font to the VGA font plane */
VgaWriteFont(0, Font8x16, sizeof(Font8x16)/sizeof(Font8x16[0]) /
VGA_FONT_CHARACTERS);
- /* Initialize the VGA BDA data */
- Bda->VGAOptions = 0x60; /* 256 KB Video RAM */
- Bda->VGASwitches = 0x09; /* High-resolution */
-
//
// FIXME: At the moment we always set a VGA mode. In the future,
// we should set this mode **only** when: