[NTVDM]
[reactos.git] / subsystems / ntvdm / bios.c
index db6dcb3..cb5f9d5 100644 (file)
@@ -19,7 +19,7 @@
 
 /* PRIVATE VARIABLES **********************************************************/
 
-static PBIOS_DATA_AREA Bda;
+PBIOS_DATA_AREA Bda;
 static BYTE BiosKeyboardMap[256];
 static HANDLE BiosConsoleInput  = INVALID_HANDLE_VALUE;
 static HANDLE BiosConsoleOutput = INVALID_HANDLE_VALUE;
@@ -46,8 +46,8 @@ static BYTE VideoMode_40x25_text[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x39, 0x0A, 0x3B,
-    0x0C, 0x3D, 0x0E, 0x3F, 0x10, 0x00, 0x12, 0x08, 0x04
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
+    0x3C, 0x3D, 0x3E, 0x3F, 0x0C, 0x00, 0x0F, 0x08, 0x00
 };
 
 static BYTE VideoMode_80x25_text[] =
@@ -67,8 +67,8 @@ static BYTE VideoMode_80x25_text[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x39, 0x0A, 0x3B,
-    0x0C, 0x3D, 0x0E, 0x3F, 0x10, 0x00, 0x12, 0x08, 0x04
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
+    0x3C, 0x3D, 0x3E, 0x3F, 0x0C, 0x00, 0x0F, 0x08, 0x00
 };
 
 static BYTE VideoMode_320x200_4color[] =
@@ -88,8 +88,8 @@ static BYTE VideoMode_320x200_4color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x13, 0x02, 0x17, 0x04, 0x04, 0x06, 0x07, 0x08, 0x11, 0x0A, 0x13,
-    0x0C, 0x15, 0x0E, 0x17, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
+    0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x0F, 0x00, 0x00
 };
 
 static BYTE VideoMode_640x200_2color[] =
@@ -109,8 +109,8 @@ static BYTE VideoMode_640x200_2color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x17, 0x02, 0x17, 0x04, 0x17, 0x06, 0x17, 0x08, 0x17, 0x0A, 0x17,
-    0x0C, 0x17, 0x0E, 0x17, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+    0x17, 0x17, 0x17, 0x17, 0x01, 0x00, 0x01, 0x00, 0x00
 };
 
 static BYTE VideoMode_320x200_16color[] =
@@ -130,8 +130,8 @@ static BYTE VideoMode_320x200_16color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x0A, 0x13,
-    0x0C, 0x15, 0x0E, 0x17, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
+    0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x0F, 0x00, 0x00
 };
 
 static BYTE VideoMode_640x200_16color[] =
@@ -151,8 +151,8 @@ static BYTE VideoMode_640x200_16color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x0A, 0x13,
-    0x0C, 0x15, 0x0E, 0x17, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
+    0x14, 0x15, 0x16, 0x17, 0x01, 0x00, 0x0F, 0x00, 0x00
 };
 
 static BYTE VideoMode_640x350_16color[] =
@@ -172,8 +172,8 @@ static BYTE VideoMode_640x350_16color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x39, 0x0A, 0x3B,
-    0x0C, 0x3D, 0x0E, 0x3F, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
+    0x3C, 0x3D, 0x3E, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00
 };
 
 static BYTE VideoMode_640x480_2color[] =
@@ -193,8 +193,8 @@ static BYTE VideoMode_640x480_2color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x3F, 0x02, 0x3F, 0x04, 0x3F, 0x06, 0x3F, 0x08, 0x3F, 0x0A, 0x3F,
-    0x0C, 0x3F, 0x0E, 0x3F, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
+    0x3F, 0x3F, 0x3F, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00
 };
 
 static BYTE VideoMode_640x480_16color[] =
@@ -214,8 +214,8 @@ static BYTE VideoMode_640x480_16color[] =
     0xFF,
 
     /* AC Registers */
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x39, 0x0A, 0x3B,
-    0x0C, 0x3D, 0x0E, 0x3F, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
+    0x3C, 0x3D, 0x3E, 0x3F, 0x01, 0x00, 0x0F, 0x00, 0x00
 };
 
 static BYTE VideoMode_320x200_256color[] =
@@ -236,7 +236,7 @@ static BYTE VideoMode_320x200_256color[] =
 
     /* AC Registers */
     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
-    0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x00, 0x12, 0x00, 0x04
+    0x0C, 0x0D, 0x0E, 0x0F, 0x41, 0x00, 0x0F, 0x00, 0x00
 };
 
 static LPBYTE VideoModes[] =
@@ -429,8 +429,12 @@ BOOLEAN BiosSetVideoMode(BYTE ModeNumber)
 
 BOOLEAN BiosSetVideoPage(BYTE PageNumber)
 {
+    /* Check if the page exists */
     if (PageNumber >= BIOS_MAX_PAGES) return FALSE;
 
+    /* Check if this is the same page */
+    if (PageNumber == Bda->VideoPage) return TRUE;
+
     /* Set the values in the BDA */
     Bda->VideoPage = PageNumber;
     Bda->VideoPageSize = BIOS_PAGE_SIZE;
@@ -744,7 +748,6 @@ VOID BiosVideoService(LPWORD Stack)
         {
             BiosSetVideoMode(LOBYTE(Eax));
             VgaClearMemory();
-
             break;
         }
 
@@ -800,15 +803,7 @@ VOID BiosVideoService(LPWORD Stack)
         /* Select Active Display Page */
         case 0x05:
         {
-            /* Check if the page exists */
-            if (LOBYTE(Eax) >= BIOS_MAX_PAGES) break;
-
-            /* Check if this is the same page */
-            if (LOBYTE(Eax) == Bda->VideoPage) break;
-
-            /* Change the video page */
             BiosSetVideoPage(LOBYTE(Eax));
-
             break;
         }
 
@@ -912,6 +907,24 @@ VOID BiosVideoService(LPWORD Stack)
             break;
         }
 
+        /* Display combination code */
+        case 0x1A:
+        {
+            switch(LOBYTE(Eax))
+            {
+                case 0x00: /* Get Display combiantion code */
+                   EmulatorSetRegister(EMULATOR_REG_AX, MAKEWORD(0x1A, 0x1A));
+                   EmulatorSetRegister(EMULATOR_REG_BX, MAKEWORD(0x08, 0x0)); /* VGA w/ color analog display */
+                   break;
+                case 0x01: /* Set Display combination code */
+                   DPRINT1("Set Display combination code - Unsupported\n");
+                   break;
+                default:
+                   break;
+            }
+            break;
+        }
+
         default:
         {
             DPRINT1("BIOS Function INT 10h, AH = 0x%02X NOT IMPLEMENTED\n",