From d6eb90ed46b4ab6d8882d66825aaa98cc0781ab9 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Wed, 13 Dec 2006 20:40:50 +0000 Subject: [PATCH] Use a BIOS call to check for keyboard input, where possible. (Not on MS C or Watcom/386.) To Do: Make it possible for Watcom/386? --- dos/pdckbd.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/dos/pdckbd.c b/dos/pdckbd.c index 86d8988c..9ff0b230 100644 --- a/dos/pdckbd.c +++ b/dos/pdckbd.c @@ -13,13 +13,20 @@ #ifdef __DJGPP__ # include -#else +#endif + +/* MS C and Watcom don't return flags from int86() */ +#if defined(MSC) || (defined(__WATCOMC__) && defined(__386__)) +# define USE_KBHIT +#endif + +#ifdef USE_KBHIT # include #endif #include "pdcdos.h" -RCSID("$Id: pdckbd.c,v 1.70 2006/12/05 23:11:43 wmcbrine Exp $"); +RCSID("$Id: pdckbd.c,v 1.71 2006/12/13 20:40:50 wmcbrine Exp $"); /************************************************************************ * Table for key code translation of function keys in keypad mode * @@ -82,7 +89,8 @@ static bool mouse_avail = FALSE, mouse_vis = FALSE, mouse_moved = FALSE, static unsigned char mouse_scroll = 0; static PDCREGS ms_regs, old_ms; static unsigned short shift_status, old_shift = 0; -static unsigned char keyboard_function = 0xff, shift_function = 0xff; +static unsigned char keyboard_function = 0xff, shift_function = 0xff, + check_function = 0xff; static const unsigned short button_map[3] = {0, 2, 1}; @@ -158,11 +166,13 @@ bool PDC_check_bios_key(void) if (scan == regs.h.al && getdosmembyte(0x496) == 0x10) { keyboard_function = 0x10; + check_function = 0x11; shift_function = 0x12; } else { keyboard_function = 0; + check_function = 1; shift_function = 2; } } @@ -227,7 +237,14 @@ bool PDC_check_bios_key(void) old_shift = shift_status; +#ifndef USE_KBHIT + regs.h.ah = check_function; + PDCINT(0x16, regs); + + return !(regs.W.flags & 64); +#else return kbhit(); +#endif } static int _process_mouse_events(void)