DOS VGA, decoding register indexes
Jukka Heinonen
jhei at iki.fi
Sat Jul 27 13:29:44 CDT 2002
This is just a small infrastructure improvement.
This patch improves fixmes a lot and is needed for
more complete VGA support.
Changelog:
Add decoding logic for VGA indexed registers.
Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.17
diff -u -r1.17 vga.c
--- dlls/winedos/vga.c 3 Jul 2002 21:04:44 -0000 1.17
+++ dlls/winedos/vga.c 27 Jul 2002 18:18:15 -0000
@@ -44,6 +44,24 @@
static BYTE vga_text_attr;
static char *textbuf_old = NULL;
+/*
+ * VGA controller ports 0x3c0, 0x3c4, 0x3ce and 0x3d4 are
+ * indexed registers. These ports are used to select VGA controller
+ * subregister that can be written to or read from using ports 0x3c1,
+ * 0x3c5, 0x3cf or 0x3d5. Selected subregister indexes are
+ * stored in variables vga_index_*.
+ *
+ * Port 0x3c0 is special because it is both index and
+ * data-write register. Flip-flop vga_address_3c0 tells whether
+ * the port acts currently as an address register. Reading from port
+ * 0x3da resets the flip-flop to address mode.
+ */
+static BYTE vga_index_3c0;
+static BYTE vga_index_3c4;
+static BYTE vga_index_3ce;
+static BYTE vga_index_3d4;
+static BOOL vga_address_3c0 = TRUE;
+
static BOOL vga_mode_initialized = FALSE;
static CRITICAL_SECTION vga_lock = CRITICAL_SECTION_INIT("VGA");
@@ -808,6 +826,21 @@
void VGA_ioport_out( WORD port, BYTE val )
{
switch (port) {
+ case 0x3c0:
+ if (vga_address_3c0)
+ vga_index_3c0 = val;
+ else
+ FIXME("Unsupported index, register 0x3c0: 0x%02x (value 0x%02x)\n",
+ vga_index_3c0, val);
+ vga_address_3c0 = !vga_address_3c0;
+ break;
+ case 0x3c4:
+ vga_index_3c4 = val;
+ break;
+ case 0x3c5:
+ FIXME("Unsupported index, register 0x3c4: 0x%02x (value 0x%02x)\n",
+ vga_index_3c4, val);
+ break;
case 0x3c8:
palreg=val; palcnt=0; break;
case 0x3c9:
@@ -817,6 +850,20 @@
palcnt=0;
}
break;
+ case 0x3ce:
+ vga_index_3ce = val;
+ break;
+ case 0x3cf:
+ FIXME("Unsupported index, register 0x3ce: 0x%02x (value 0x%02x)\n",
+ vga_index_3ce, val);
+ break;
+ case 0x3d4:
+ vga_index_3d4 = val;
+ break;
+ case 0x3d5:
+ FIXME("Unsupported index, register 0x3d4: 0x%02x (value 0x%02x)\n",
+ vga_index_3d4, val);
+ break;
default:
FIXME("Unsupported VGA register: 0x%04x (value 0x%02x)\n", port, val);
}
@@ -827,7 +874,27 @@
BYTE ret;
switch (port) {
+ case 0x3c1:
+ FIXME("Unsupported index, register 0x3c0: 0x%02x\n",
+ vga_index_3c0);
+ return 0xff;
+ case 0x3c5:
+ FIXME("Unsupported index, register 0x3c4: 0x%02x\n",
+ vga_index_3c4);
+ return 0xff;
+ case 0x3cf:
+ FIXME("Unsupported index, register 0x3ce: 0x%02x\n",
+ vga_index_3ce);
+ return 0xff;
+ case 0x3d5:
+ FIXME("Unsupported index, register 0x3d4: 0x%02x\n",
+ vga_index_3d4);
+ return 0xff;
case 0x3da:
+ /*
+ * Read from this register resets register 0x3c0 address flip-flop.
+ */
+ vga_address_3c0 = TRUE;
/* since we don't (yet?) serve DOS VM requests while VGA_Poll is running,
we need to fake the occurrence of the vertical refresh */
ret=vga_refresh?0x00:0x0b; /* toggle video RAM and lightpen and VGA refresh bits ! */
--
Jukka Heinonen <http://www.iki.fi/jhei/>
More information about the wine-patches
mailing list