Simulate the VGA vertical refresh.

diff --git a/graphics/vga.c b/graphics/vga.c
index 9e4801f..be4730d 100644
--- a/graphics/vga.c
+++ b/graphics/vga.c
@@ -21,7 +21,7 @@
 static DDSURFACEDESC sdesc;
 static WORD poll_timer;
 static CRITICAL_SECTION vga_crit;
-static int vga_polling;
+static int vga_polling,vga_refresh;
 
 int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth)
 {
@@ -47,6 +47,7 @@
             lpddraw=NULL;
             return 1;
         }
+        vga_refresh=0;
         InitializeCriticalSection(&vga_crit);
         /* poll every 20ms (50fps should provide adequate responsiveness) */
         poll_timer = CreateSystemTimer( 20, (FARPROC16)VGA_Poll );
@@ -141,6 +142,7 @@
             for (X=0; X<Width; X++) if (dat[X]) TRACE(ddraw,"data(%d) at (%d,%d)\n",dat[X],X,Y);
         }
         VGA_Unlock();
+        vga_refresh=1;
         EnterCriticalSection(&vga_crit);
         vga_polling--;
     }
@@ -161,5 +163,25 @@
                 VGA_SetPalette(&paldat,palreg,1);
                 palreg++;
             }
+            break;
     }
 }
+
+BYTE VGA_ioport_in( WORD port )
+{
+    BYTE ret;
+
+    switch (port) {
+        case 0x3da:
+            /* since we don't (yet?) serve DOS VM requests while VGA_Poll is running,
+               we need to fake the occurrence of the vertical refresh */
+            if (lpddraw) {
+                ret=vga_refresh?0x00:0x08;
+                vga_refresh=0;
+            } else ret=0x08;
+            break;
+        default:
+            ret=0xff;
+    }
+    return ret;
+}
diff --git a/include/vga.h b/include/vga.h
index d474411..4cc3eef 100644
--- a/include/vga.h
+++ b/include/vga.h
@@ -19,5 +19,6 @@
 void VGA_Unlock(void);
 void VGA_Poll(void);
 void VGA_ioport_out(WORD port, BYTE val);
+BYTE VGA_ioport_in(WORD port);
 
 #endif /* __WINE_VGA_H */
diff --git a/msdos/ioports.c b/msdos/ioports.c
index 05e1a93..14cdcef 100644
--- a/msdos/ioports.c
+++ b/msdos/ioports.c
@@ -239,6 +239,9 @@
         case 0x201:
             b = 0xff; /* no joystick */
             break;
+        case 0x3da:
+            b = VGA_ioport_in( port );
+            break;
         default:
             WARN( int, "Direct I/O read attempted from port %x\n", port);
             b = 0xff;