Redirect DOS VGA controller I/O to VGA emulation

Jukka Heinonen jhei at iki.fi
Sat Jun 22 05:33:49 CDT 2002


This patch catches all reads and writes to VGA controller
and passes them to VGA emulation, which now dumps a message
when unsupported registers are accessed. This is because I believe 
that VGA emulation is the only place that should know what
VGA registers Wine supports and what should be done with them.
Besides, if this patch is accepted I might even try to add
support for few registers ;)

The patch also catches 16/32 bit reads and writes to VGA
registers and complains to user (some programs really
do use 16-bit writes to VGA registers) which is a much better
thing to do than to silently ignore these. And finally,
for some reason, VGA emulation used a strange set of
flags when creating a window for DirectDraw. I changed these
flags to those I have seen in nearly all DirectDraw examples
so that there won't be problems when DirectDraw code is updated.
For example, if OWN_WINDOW is disabled in DirectDraw code, 
the old flags would have caused problems...


Changelog:
  Redirect all reads and writes to VGA controller to VGA emulation.
  Catch and report 16/32-bit reads/writes to VGA controller.
  Use correct flags when creating full screen DirectDraw window for VGA.


Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.13
diff -b -u -r1.13 vga.c
--- dlls/winedos/vga.c  31 May 2002 23:40:54 -0000      1.13
+++ dlls/winedos/vga.c  22 Jun 2002 10:11:18 -0000
@@ -269,7 +269,7 @@
             return;
         }
         if (!vga_hwnd) {
-            vga_hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYS
MENU,0,0,par->Xres,par->Yres,0,0,0,NULL);
+            vga_hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_VISIBLE,0,0,par->Xres,pa
r->Yres,0,0,0,NULL);
             if (!vga_hwnd) {
                 ERR("Failed to create user window.\n");
                 IDirectDraw_Release(lpddraw);
@@ -768,6 +768,8 @@
                 palcnt=0;
             }
             break;
+        default:
+            FIXME("Unsupported VGA register: 0x%04x (value 0x%02x)\n", port, val);
     }
 }
 
@@ -789,6 +791,7 @@
             break;
         default:
             ret=0xff;
+            FIXME("Unsupported VGA register: 0x%04x\n", port);
     }
     return ret;
 }




Index: dlls/winedos/ioports.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/ioports.c,v
retrieving revision 1.4
diff -b -u -r1.4 ioports.c
--- dlls/winedos/ioports.c      31 May 2002 23:40:54 -0000      1.4
+++ dlls/winedos/ioports.c      22 Jun 2002 10:09:48 -0000
@@ -24,7 +24,9 @@
 #include "windef.h"
 #include "dosexe.h"
 #include "vga.h"
+#include "wine/debug.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(int);
 
 /**********************************************************************
  *         DOSVM_inport
@@ -41,8 +43,40 @@
     case 0x22e:
         *res = (DWORD)SB_ioport_in( port );
        break;
-    case 0x3ba:
+    case 0x3c0:
+    case 0x3c1:
+    case 0x3c2:
+    case 0x3c3:
+    case 0x3c4:
+    case 0x3c5:
+    case 0x3c6:
+    case 0x3c7:
+    case 0x3c8:
+    case 0x3c9:
+    case 0x3ca:
+    case 0x3cb: 
+    case 0x3cc:
+    case 0x3cd:
+    case 0x3ce:
+    case 0x3cf:
+    case 0x3d0:
+    case 0x3d1:
+    case 0x3d2:
+    case 0x3d3:
+    case 0x3d4:
+    case 0x3d5:
+    case 0x3d6:
+    case 0x3d7:
+    case 0x3d8:
+    case 0x3d9:
     case 0x3da:
+    case 0x3db: 
+    case 0x3dc:
+    case 0x3dd:
+    case 0x3de:
+    case 0x3df:
+        if(size > 1)
+           FIXME("Trying to read more than one byte from VGA!\n");
         *res = (DWORD)VGA_ioport_in( port );
         break;
     case 0x00:
@@ -102,8 +136,40 @@
     case 0x22c:
         SB_ioport_out( port, (BYTE)value );
         break;
+    case 0x3c0:
+    case 0x3c1:
+    case 0x3c2:
+    case 0x3c3:
+    case 0x3c4:
+    case 0x3c5:
+    case 0x3c6:
+    case 0x3c7:
     case 0x3c8:
     case 0x3c9:
+    case 0x3ca:
+    case 0x3cb: 
+    case 0x3cc:
+    case 0x3cd:
+    case 0x3ce:
+    case 0x3cf:
+    case 0x3d0:
+    case 0x3d1:
+    case 0x3d2:
+    case 0x3d3:
+    case 0x3d4:
+    case 0x3d5:
+    case 0x3d6:
+    case 0x3d7:
+    case 0x3d8:
+    case 0x3d9:
+    case 0x3da:
+    case 0x3db: 
+    case 0x3dc:
+    case 0x3dd:
+    case 0x3de:
+    case 0x3df:
+        if(size > 1)
+           FIXME("Trying to write more than one byte to VGA!\n");
         VGA_ioport_out( port, (BYTE)value );
         break;
     case 0x00:



-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-patches mailing list