]> granicus.if.org Git - nethack/commitdiff
Call the window function directly if supported
authorRay Chason <ray.chason@protonmail.com>
Sat, 25 Jan 2020 18:49:26 +0000 (13:49 -0500)
committerPasi Kallinen <paxed@alt.org>
Mon, 27 Jan 2020 07:54:58 +0000 (09:54 +0200)
Some BIOSes allow calling the window function directly, bypassing the
logic that distinguishes this call from other BIOS calls. Should be
faster on some systems.

sys/msdos/vidvesa.c

index f1e1848ef65370f2b20f0aff8f582a47208cb430..07a76219e12af5e1b1caf98817c03046a699f037 100644 (file)
@@ -120,6 +120,7 @@ static unsigned short vesa_y_center; /* Y centering offset */
 static unsigned short vesa_scan_line; /* Bytes per scan line */
 static int vesa_read_win;  /* Select the read window */
 static int vesa_write_win; /* Select the write window */
+static unsigned long vesa_win_func;
 static unsigned long vesa_win_pos[2]; /* Window position */
 static unsigned long vesa_win_addr[2]; /* Window physical address */
 static unsigned long vesa_win_size; /* Window size */
@@ -245,7 +246,14 @@ unsigned long offset;
         regs.h.bl = window;
         regs.x.dx = offset / vesa_win_gran;
         pos = regs.x.dx * vesa_win_gran;
-        (void) __dpmi_int(VIDEO_BIOS, &regs);
+
+        if (vesa_win_func != 0) {
+            regs.x.cs = vesa_win_func >> 16;
+            regs.x.ip = vesa_win_func & 0xFFFF;
+            (void) __dpmi_simulate_real_mode_procedure_retf(&regs);
+        } else {
+            (void) __dpmi_int(VIDEO_BIOS, &regs);
+        }
         vesa_win_pos[window] = pos;
     }
 
@@ -921,7 +929,7 @@ vesa_detect()
     dosmemput(&vbe_info, sizeof(vbe_info), vbe_info_seg * 16L);
 
     /* Request VESA BIOS information */
-       memset(&regs, 0, sizeof(regs));
+    memset(&regs, 0, sizeof(regs));
     regs.x.ax = 0x4F00;
     regs.x.di = 0;
     regs.x.es = vbe_info_seg;
@@ -1004,6 +1012,7 @@ vesa_detect()
             break;
         }
     }
+    vesa_win_func = mode_info.WinFuncPtr;
     vesa_win_addr[0] = mode_info.WinASegment * 16L;
     vesa_win_addr[1] = mode_info.WinBSegment * 16L;
     vesa_win_pos[0] = 0xFFFFFFFF; /* position unknown */