From d97ea85a8677e16558cb4348014d49fdb1f2ea4a Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Wed, 7 Sep 2016 14:38:58 +0000 Subject: [PATCH] [VGADDI] Explain how VGA write mode 2 works. No code changes! CORE-8164 svn path=/trunk/; revision=72607 --- .../drivers/displays/vga/vgavideo/vgavideo.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reactos/win32ss/drivers/displays/vga/vgavideo/vgavideo.c b/reactos/win32ss/drivers/displays/vga/vgavideo/vgavideo.c index 0e23a50e14d..f0bb813e5dd 100644 --- a/reactos/win32ss/drivers/displays/vga/vgavideo/vgavideo.c +++ b/reactos/win32ss/drivers/displays/vga/vgavideo/vgavideo.c @@ -681,6 +681,19 @@ vgaWriteScan ( int x, int y, int w, void *b ) i += 8, off++; while (i < w) { + /* + * In write mode 2, the incoming data is 4-bit and represents the + * value of entire bytes on each of the 4 memory planes. First, VGA + * performs a logical operation on these bytes and the value of the + * latch register, but in this case there is none. Then, only the + * bits that are set in the bit mask are used from the resulting + * bytes, and the other bits are taken from the latch register. + * + * The latch register always contains the value previously read from + * VGA memory, and therefore, we must first read from vp[off] to + * load the latch register, and then write bp[i] to vp[off], which + * will be converted to 4 bytes of VGA memory as described. + */ dummy = vp[off]; dummy = bp[i]; vp[off] = dummy;