resend: small DOS vga improvement

Andreas Mohr andi at rhlx01.fht-esslingen.de
Fri Jan 17 18:38:58 CST 2003


Hi all,

please disregard my previous patch.

I discovered that

        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 ! */
            if (VGA_IsTimerRunning())
                vga_refresh=0;
            else
#endif
                /* Also fake the occurence of the vertical refresh when no graphic
                   mode has been set */
                vga_refresh=!vga_refresh;
            break;

is WRONG since VGA_IsTimerRunning() is always true:
VGA_InstallTimer gets called in both VGA_DoSetMode() (graphics) and
VGA_SetAlphaMode() (text).
(doh !)
Talk about too many people having done too many changes in one and the same
code part :-))

So until there is further information about how to do it properly,
I'll just remove the vga_refresh reset in the VGA_IsTimerRunning() case,
and of course this makes Turbo Pascal 6 usable (although screen update is
a bit slower than IDA, most likely due to using int 10h instead of video
mem and also probing I/O port 0x3da).

In other words: please yell NOW in case you're affected by my modification
(or rather: "fix").

And of course I kept the inlining of the functions.

Andreas Mohr

Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.27
diff -u -r1.27 vga.c
--- dlls/winedos/vga.c	7 Jan 2003 20:36:23 -0000	1.27
+++ dlls/winedos/vga.c	18 Jan 2003 00:51:34 -0000
@@ -278,29 +278,29 @@
     }
 }
 
-static void VGA_InstallTimer(unsigned Rate)
+static void VGA_InstallTimer(unsigned rate)
 {
     if (!VGA_timer_thread)
     {
         VGA_timer = CreateWaitableTimerA( NULL, FALSE, NULL );
         VGA_timer_thread = CreateThread( NULL, 0, VGA_TimerThread, NULL, 0, NULL );
     }
-    QueueUserAPC( set_timer_rate, VGA_timer_thread, (ULONG_PTR)Rate );
+    QueueUserAPC( set_timer_rate, VGA_timer_thread, (ULONG_PTR)rate );
 }
 
-static BOOL VGA_IsTimerRunning(void)
+static inline BOOL VGA_IsTimerRunning(void)
 {
     return VGA_timer_thread ? TRUE : FALSE;
 }
 
-HANDLE VGA_AlphaConsole(void)
+static inline HANDLE VGA_AlphaConsole(void)
 {
     /* this assumes that no Win32 redirection has taken place, but then again,
      * only 16-bit apps are likely to use this part of Wine... */
     return GetStdHandle(STD_OUTPUT_HANDLE);
 }
 
-char*VGA_AlphaBuffer(void)
+static inline char *VGA_AlphaBuffer(void)
 {
     return (char *)0xb8000;
 }
@@ -470,7 +470,7 @@
 }
 
 /* Get a single [char wide] color in 16 color mode. */
-char VGA_GetColor16(int reg)
+inline char VGA_GetColor16(int reg)
 {
 
     if (!lpddraw) return 0;
@@ -532,7 +532,7 @@
     return sdesc.lpSurface;
 }
 
-void VGA_Unlock(void)
+inline void VGA_Unlock(void)
 {
     IDirectDrawSurface_Unlock(lpddsurf,sdesc.lpSurface);
 }
@@ -564,7 +564,7 @@
  * Get start of 64k window at 0xa0000 in bytes.
  * Value is -1 in color plane modes.
  */
-int VGA_GetWindowStart()
+inline int VGA_GetWindowStart()
 {
     return vga_fb_window;
 }
@@ -1053,12 +1053,15 @@
             /* 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 ! */
-            if (VGA_IsTimerRunning())
-                vga_refresh=0;
-            else
-                /* Also fake the occurence of the vertical refresh when no graphic
-                   mode has been set */
-                vga_refresh=!vga_refresh;
+            /* Also fake the occurence of the vertical refresh when no graphic
+               mode has been set */
+            vga_refresh=!vga_refresh;
+	    /* FIXME: most likely the 0x3da bit values should be set
+	     * by deducing the current setting it's supposed to have
+	     * from some current timer tick value, instead of
+	     * doing such a stupid thing as toggling these bits on every I/O
+	     * access...
+	     */
             break;
         default:
             ret=0xff;

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany



More information about the wine-patches mailing list