Author: hbelusca
Date: Wed Oct 1 00:40:36 2014
New Revision: 64431
URL:
http://svn.reactos.org/svn/reactos?rev=64431&view=rev
Log:
[NTVDM]
The highest bit of the mode number is used to determine whether or not we need to clear
the screen. Fix the existing code that was disabled in revision 61907 because it was
completely wrong. Now we correctly support this feature. Also check the mode number limit
and fail if it is unsupported.
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] Wed Oct 1 00:40:36 2014
@@ -1003,11 +1003,23 @@
static BOOLEAN VidBiosSetVideoMode(BYTE ModeNumber)
{
BYTE Page;
-
COORD Resolution;
- PVGA_REGISTERS VgaMode = VideoModes[ModeNumber];
-
- DPRINT1("Switching to mode %Xh; VgaMode = 0x%p\n", ModeNumber, VgaMode);
+ BOOLEAN DoNotClear = !!(ModeNumber & 0x80);
+ PVGA_REGISTERS VgaMode;
+
+ /* Retrieve the real mode number and check its validity */
+ ModeNumber &= 0x7F;
+ // if (ModeNumber >= sizeof(VideoModes)/sizeof(VideoModes[0]))
+ if (ModeNumber > BIOS_MAX_VIDEO_MODE)
+ {
+ DPRINT1("VidBiosSetVideoMode -- Mode %02Xh invalid\n", ModeNumber);
+ return FALSE;
+ }
+
+ VgaMode = VideoModes[ModeNumber];
+
+ DPRINT1("Switching to mode %02Xh %s clearing the screen; VgaMode =
0x%p\n",
+ ModeNumber, (DoNotClear ? "without" : "and"), VgaMode);
if (!VgaSetRegisters(VgaMode)) return FALSE;
@@ -1019,8 +1031,7 @@
* See Ralf Brown:
http://www.ctyme.com/intr/rb-0069.htm
* for more information.
*/
- // if ((ModeNumber & 0x08) == 0) VgaClearMemory();
- VgaClearMemory();
+ if (!DoNotClear) VgaClearMemory();
// Bda->CrtModeControl;
// Bda->CrtColorPaletteMask;