Skip to content

Commit d97ea85

Browse files
committed
[VGADDI]
Explain how VGA write mode 2 works. No code changes! CORE-8164 svn path=/trunk/; revision=72607
1 parent fc68670 commit d97ea85

File tree

1 file changed

+13
-0
lines changed
  • reactos/win32ss/drivers/displays/vga/vgavideo

1 file changed

+13
-0
lines changed

reactos/win32ss/drivers/displays/vga/vgavideo/vgavideo.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,19 @@ vgaWriteScan ( int x, int y, int w, void *b )
681681
i += 8, off++;
682682
while (i < w)
683683
{
684+
/*
685+
* In write mode 2, the incoming data is 4-bit and represents the
686+
* value of entire bytes on each of the 4 memory planes. First, VGA
687+
* performs a logical operation on these bytes and the value of the
688+
* latch register, but in this case there is none. Then, only the
689+
* bits that are set in the bit mask are used from the resulting
690+
* bytes, and the other bits are taken from the latch register.
691+
*
692+
* The latch register always contains the value previously read from
693+
* VGA memory, and therefore, we must first read from vp[off] to
694+
* load the latch register, and then write bp[i] to vp[off], which
695+
* will be converted to 4 bytes of VGA memory as described.
696+
*/
684697
dummy = vp[off];
685698
dummy = bp[i];
686699
vp[off] = dummy;

0 commit comments

Comments
 (0)