From: Ray Chason Date: Sat, 25 Jan 2020 18:49:26 +0000 (-0500) Subject: Call the window function directly if supported X-Git-Tag: NetHack-3.7.0_WIP~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab6424b31c23dafc98aa7031b76446ad1f25fbb7;p=nethack Call the window function directly if supported 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. --- diff --git a/sys/msdos/vidvesa.c b/sys/msdos/vidvesa.c index f1e1848ef..07a76219e 100644 --- a/sys/msdos/vidvesa.c +++ b/sys/msdos/vidvesa.c @@ -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, ®s); + + 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(®s); + } else { + (void) __dpmi_int(VIDEO_BIOS, ®s); + } 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(®s, 0, sizeof(regs)); + memset(®s, 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 */