mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:53:02 +00:00
[NTVDM:SVGA]
Fix read mode 1. svn path=/trunk/; revision=72479
This commit is contained in:
parent
b4743181f7
commit
3ecb5aa01a
1 changed files with 12 additions and 12 deletions
|
@ -1814,33 +1814,33 @@ VOID FASTCALL VgaReadMemory(ULONG Address, PVOID Buffer, ULONG Size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ULONG BitExpandTable[] =
|
const ULONG BitExpandInvertTable[] =
|
||||||
{
|
{
|
||||||
0x00000000, 0x000000FF, 0x0000FF00, 0x0000FFFF,
|
0xFFFFFFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFFFF0000,
|
||||||
0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00FFFFFF,
|
0xFF00FFFF, 0xFF00FF00, 0xFF0000FF, 0xFF000000,
|
||||||
0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF,
|
0x00FFFFFF, 0x00FFFF00, 0x00FF00FF, 0x00FF0000,
|
||||||
0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFFFF
|
0x0000FFFF, 0x0000FF00, 0x000000FF, 0x00000000
|
||||||
};
|
};
|
||||||
|
|
||||||
ULONG ColorCompareBytes = BitExpandTable[VgaGcRegisters[VGA_GC_COLOR_COMPARE_REG] & 0x0F];
|
ULONG ColorCompareBytes = BitExpandInvertTable[VgaGcRegisters[VGA_GC_COLOR_COMPARE_REG] & 0x0F];
|
||||||
ULONG ColorIgnoreBytes = BitExpandTable[VgaGcRegisters[VGA_GC_COLOR_IGNORE_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:
|
* 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 = VgaGcRegisters[VGA_GC_COLOR_COMPARE_REG] * 0x000204081;
|
||||||
* ColorCompareBytes &= 0x01010101;
|
* ColorCompareBytes &= 0x01010101;
|
||||||
* ColorCompareBytes = (ColorCompareBytes << 8) - ColorCompareBytes;
|
* ColorCompareBytes = ~((ColorCompareBytes << 8) - ColorCompareBytes);
|
||||||
*
|
*
|
||||||
* ColorIgnoreBytes = VgaGcRegisters[VGA_GC_COLOR_IGNORE_REG] * 0x000204081;
|
* ColorIgnoreBytes = VgaGcRegisters[VGA_GC_COLOR_IGNORE_REG] * 0x000204081;
|
||||||
* ColorIgnoreBytes &= 0x01010101;
|
* ColorIgnoreBytes &= 0x01010101;
|
||||||
* ColorIgnoreBytes = (ColorIgnoreBytes << 8) - ColorIgnoreBytes;
|
* ColorIgnoreBytes = ~((ColorIgnoreBytes << 8) - ColorIgnoreBytes);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Loop through each byte */
|
/* Loop through each byte */
|
||||||
for (i = 0; i < Size; i++)
|
for (i = 0; i < Size; i++)
|
||||||
{
|
{
|
||||||
ULONG PlaneData;
|
ULONG PlaneData = 0;
|
||||||
|
|
||||||
/* This should always return a plane 0 address */
|
/* This should always return a plane 0 address */
|
||||||
VideoAddress = VgaTranslateAddress(Address + i);
|
VideoAddress = VgaTranslateAddress(Address + i);
|
||||||
|
@ -1849,13 +1849,13 @@ VOID FASTCALL VgaReadMemory(ULONG Address, PVOID Buffer, ULONG Size)
|
||||||
PlaneData = *(PULONG)&VgaMemory[VideoAddress * VGA_NUM_BANKS];
|
PlaneData = *(PULONG)&VgaMemory[VideoAddress * VGA_NUM_BANKS];
|
||||||
|
|
||||||
/* Reverse the bytes for which the color compare register is zero */
|
/* Reverse the bytes for which the color compare register is zero */
|
||||||
PlaneData ^= ~ColorCompareBytes;
|
PlaneData ^= ColorCompareBytes;
|
||||||
|
|
||||||
/* Apply the color ignore register */
|
/* Apply the color ignore register */
|
||||||
PlaneData |= ColorIgnoreBytes;
|
PlaneData |= ColorIgnoreBytes;
|
||||||
|
|
||||||
/* Store the value in the buffer */
|
/* 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue