[NTVDM]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 24 Jul 2016 18:25:50 +0000 (18:25 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sun, 24 Jul 2016 18:25:50 +0000 (18:25 +0000)
Implement the VGA AC Color Select register.
Implement INT 0x10, AH = 0x10, subfunction AL = 0x13.

svn path=/trunk/; revision=71992

reactos/subsystems/mvdm/ntvdm/bios/vidbios.c
reactos/subsystems/mvdm/ntvdm/hardware/video/svga.c

index 5da00c1..b880197 100644 (file)
@@ -3379,6 +3379,31 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack)
                     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:
                 {
index e970e76..05fc21c 100644 (file)
@@ -946,8 +946,26 @@ static VOID VgaUpdateFramebuffer(VOID)
                      * if external palette access is disabled, otherwise (in case
                      * of palette loading) it is a blank pixel.
                      */
-                    PixelData = (VgaAcPalDisable ? VgaAcRegisters[PixelData & 0x0F]
-                                                 : 0);
+
+                    if (VgaAcPalDisable)
+                    {
+                        if (!(VgaAcRegisters[VGA_AC_CONTROL_REG] & VGA_AC_CONTROL_P54S))
+                        {
+                            /* Bits 4 and 5 are taken from the palette register */
+                            PixelData = ((VgaAcRegisters[VGA_AC_COLOR_SEL_REG] << 4) & 0xC0)
+                                        | (VgaAcRegisters[PixelData & 0x0F] & 0x3F);
+                        }
+                        else
+                        {
+                            /* Bits 4 and 5 are taken from the color select register */
+                            PixelData = (VgaAcRegisters[VGA_AC_COLOR_SEL_REG] << 4)
+                                        | (VgaAcRegisters[PixelData & 0x0F] & 0x0F);
+                        }
+                    }
+                    else
+                    {
+                        PixelData = 0;
+                    }
                 }
 
                 /* Take into account DoubleVision mode when checking for pixel updates */