Article View: comp.os.msdos.programmer
Article #6674Re: Output from F11 & F12 Keys
From: Tim Peoples
Date: Wed, 15 May 1991 16:28
Date: Wed, 15 May 1991 16:28
53 lines
2249 bytes
2249 bytes
u-mwong%peruvian.utah.edu@cs.utah.edu (Michael Wong) writes:
> Hi...I'm trying to get the character codes from the F11 and F12 keys
>(normal/shift/alt/control) but seem to have no luck. Nothing seems to
>come out when I read a keypress from them. Do I have to do something
>in order to "enable" these keys? If so, how do I do it in C? I'd appreciate
>any responses to my query...
>
If you are getting no response from the F11 and F12 keys it could
be either of two problems.
1. It is possible that your BIOS does not support the
extended keyboard. If so, you need a new one ( BIOS
that is ).
2. In order to access the keys in question you need
to make a call to int 16h functions 11h and 10h in
that order. The call to f11h is to see if there is
anything in the buffer ( Zflag set if buffer empty ).
The call to f10h is to remove that key from the buffer.
( f11h does not clear the keyboard buffer and f10h waits
until a key is pressed before returning )
Try this: ( TC2.0 or TC++ )
----------------------------------------------------------------------------
#include <dos.h> /* for both routines */
int xkbhit( void ) /* Returns zero if buffer empty, one otherwise */
{
union REGS regs;
regs.h.ah = 0x11;
int86( 0x16, ®s, ®s );
if ( regs.x.flags & 0x0080 ) return 0;
return 1;
}
int xgetch( void )
{
union REGS regs;
regs.h.ah = 0x10;
int86( 0x16, ®s, ®s );
return regs.x.ax; /* Scan code in high byte, char in low byte */
}
---------------------------------------------------------------------------
If this doesn't work, better check your BIOS date.
Hope this helps. Tim - ;-)
Technical Details
Message-ID:
<tep.674324894@engr>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!think.com!zaphod.mps.ohio-state.edu!wuarchive!kuhub.cc.ukans.edu!maverick.ksu.ksu.edu!uafhp!engr!tepReferences:
<1991May4.164802.11042@hellgate.utah.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!think.com!zaphod.mps.ohio-state.edu!wuarchive!kuhub.cc.ukans.edu!maverick.ksu.ksu.edu!uafhp!engr!tep From: tep@engr.uark.edu (Tim Peoples) Newsgroups: comp.os.msdos.programmer Subject: Re: Output from F11 & F12 Keys Message-ID: <tep.674324894@engr> Date: 15 May 91 16:28:14 GMT References: <1991May4.164802.11042@hellgate.utah.edu> Sender: netnews@uafhp.uark.edu Lines: 53