www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/12/11/10:08:54

Date: Sat, 11 Dec 1993 08:14 EST
From: "Wonkoo Kim, EE, U. of Pittsburgh" <WKIM AT vms DOT cis DOT pitt DOT edu>
Subject: v1.11 bioskey(1) broken
To: djgpp AT sun DOT soe DOT clarkson DOT EDU

Hi.

I am glad to see better support of Borland compatibility in ver 1.11.  
Thanks.

I found that a new function bioskey() in the new version 1.11 does not work
correctly.  My compiled program behaved abnormally due to the broken
bioskey(1).  bioskey(0) and bioskey(2) seem to be okay.  So, we should use
kbhit() instead of bioskey(1) to go around. 

Regards,

Wonkoo Kim
wkim AT vms DOT cis DOT pitt DOT edu


(I hope a new _bios_keybrd() to support enhanced kbd)

Here is a test program for bioskey().  (compile: gcc test.c -o test -lpc)
If you replace kbhit() with bioskey(1), the program will not work.

/*
 *  Keyboard scancode	--- Wonkoo Kim, 1993
 */

#include <stdio.h>
#include <conio.h>
#include <bios.h>

#define ESC	0x1b

int main(void)
{
    unsigned int key;

    printf ("\nKEY SCAN CODES: (Ctrl-C or Ctrl-Break to quit)\n\n");
    while (1) {
    
	if (kbhit())
	/* if (bioskey(1)) */	/** <=== bioskey(1) not working ***/
			    /* check keyboard buffer*/
	{		
            key = bioskey(0);       /* read keyboard buffer */
	    printf ("SCAN/ASCII= 0x%4.4x (%3d,%3d),  ",
		    key, key>>8, key & 0xff );
	    key = bioskey(2);	    /* read keyboard status */
	    printf ("STATE= 0x%2.2x (", key);
	    if (key & 0x80) printf ("Ins,");        else printf("-,");
	    if (key & 0x40) printf ("Caps,");       else printf("-,");
	    if (key & 0x20) printf ("NumL,");       else printf("-,");
	    if (key & 0x10) printf ("ScrL,");       else printf("-,");
	    if (key & 0x08) printf ("Alt,");        else printf("-,");
	    if (key & 0x04) printf ("Ctrl,");       else printf("-,");
	    if (key & 0x02) printf ("LShft,");      else printf("-,");
	    if (key & 0x01) printf ("RShft)\n");    else printf("-)\n");
        }
    }
}


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019