Author: aandrejevic
Date: Sat Apr 18 22:00:44 2015
New Revision: 67280
URL:
http://svn.reactos.org/svn/reactos?rev=67280&view=rev
Log:
[NTVDM]
Fix host-to-VGA address translation.
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/hard…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/hardware/video/vga.c [iso-8859-1] Sat Apr 18
22:00:44 2015
@@ -629,13 +629,13 @@
{
/* The lowest two bits are the plane number */
Plane = Offset & 0x03;
- Offset >>= 2;
+ Offset &= ~3;
}
else if (VgaGcRegisters[VGA_GC_MODE_REG] & VGA_GC_MODE_OE)
{
/* The LSB is the plane number */
Plane = Offset & 0x01;
- Offset >>= 1;
+ Offset &= ~1;
}
else
{
@@ -643,9 +643,6 @@
Plane = VgaGcRegisters[VGA_GC_READ_MAP_SEL_REG] & 0x03;
}
- /* Multiply the offset by the address size */
- Offset *= VgaGetAddressSize();
-
return Offset + Plane * VGA_BANK_SIZE;
}
@@ -656,17 +653,14 @@
/* Check for chain-4 and odd-even mode */
if (VgaSeqRegisters[VGA_SEQ_MEM_REG] & VGA_SEQ_MEM_C4)
{
- /* Shift the offset to the right by 2 */
- Offset >>= 2;
+ /* Clear the lowest two bits since they're used to select the bank */
+ Offset &= ~3;
}
else if (VgaGcRegisters[VGA_GC_MODE_REG] & VGA_GC_MODE_OE)
{
- /* Shift the offset to the right by 1 */
- Offset >>= 1;
- }
-
- /* Multiply the offset by the address size */
- Offset *= VgaGetAddressSize();
+ /* Clear the lowest bit since it's used to select odd/even */
+ Offset &= ~1;
+ }
/* Return the offset on plane 0 */
return Offset;