Author: aandrejevic
Date: Sat Aug 27 23:40:44 2016
New Revision: 72479

URL: http://svn.reactos.org/svn/reactos?rev=72479&view=rev
Log:
[NTVDM:SVGA]
Fix read mode 1.


Modified:
    trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/svga.c

Modified: trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/svga.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/svga.c?rev=72479&r1=72478&r2=72479&view=diff
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/svga.c   [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/svga.c   [iso-8859-1] 
Sat Aug 27 23:40:44 2016
@@ -1814,33 +1814,33 @@
     }
     else
     {
-        const ULONG BitExpandTable[] =
-        {
-            0x00000000, 0x000000FF, 0x0000FF00, 0x0000FFFF,
-            0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00FFFFFF,
-            0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF,
-            0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFFFF
+        const ULONG BitExpandInvertTable[] =
+        {
+            0xFFFFFFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFFFF0000,
+            0xFF00FFFF, 0xFF00FF00, 0xFF0000FF, 0xFF000000,
+            0x00FFFFFF, 0x00FFFF00, 0x00FF00FF, 0x00FF0000,
+            0x0000FFFF, 0x0000FF00, 0x000000FF, 0x00000000
         };
 
-        ULONG ColorCompareBytes = 
BitExpandTable[VgaGcRegisters[VGA_GC_COLOR_COMPARE_REG] & 0x0F];
-        ULONG ColorIgnoreBytes = 
BitExpandTable[VgaGcRegisters[VGA_GC_COLOR_IGNORE_REG] & 0x0F];
+        ULONG ColorCompareBytes = 
BitExpandInvertTable[VgaGcRegisters[VGA_GC_COLOR_COMPARE_REG] & 0x0F];
+        ULONG ColorIgnoreBytes = 
BitExpandInvertTable[VgaGcRegisters[VGA_GC_COLOR_IGNORE_REG] & 0x0F];
 
         /*
          * These values can also be computed in the following way, but using 
the table seems to be faster:
          *
          * ColorCompareBytes = VgaGcRegisters[VGA_GC_COLOR_COMPARE_REG] * 
0x000204081;
          * ColorCompareBytes &= 0x01010101;
-         * ColorCompareBytes = (ColorCompareBytes << 8) - ColorCompareBytes;
+         * ColorCompareBytes = ~((ColorCompareBytes << 8) - ColorCompareBytes);
          *
          * ColorIgnoreBytes = VgaGcRegisters[VGA_GC_COLOR_IGNORE_REG] * 
0x000204081;
          * ColorIgnoreBytes &= 0x01010101;
-         * ColorIgnoreBytes = (ColorIgnoreBytes << 8) - ColorIgnoreBytes;
+         * ColorIgnoreBytes = ~((ColorIgnoreBytes << 8) - ColorIgnoreBytes);
          */
 
         /* Loop through each byte */
         for (i = 0; i < Size; i++)
         {
-            ULONG PlaneData;
+            ULONG PlaneData = 0;
 
             /* This should always return a plane 0 address */
             VideoAddress = VgaTranslateAddress(Address + i);
@@ -1849,13 +1849,13 @@
             PlaneData = *(PULONG)&VgaMemory[VideoAddress * VGA_NUM_BANKS];
 
             /* Reverse the bytes for which the color compare register is zero 
*/
-            PlaneData ^= ~ColorCompareBytes;
+            PlaneData ^= ColorCompareBytes;
 
             /* Apply the color ignore register */
             PlaneData |= ColorIgnoreBytes;
 
             /* Store the value in the buffer */
-            BufPtr[i] = (PlaneData | (PlaneData >> 8) | (PlaneData >> 16) | 
(PlaneData >> 24)) & 0xFF;
+            BufPtr[i] = (PlaneData & (PlaneData >> 8) & (PlaneData >> 16) & 
(PlaneData >> 24)) & 0xFF;
         }
     }
 


Reply via email to