Article View: comp.os.msdos.programmer
Article #1170Re: Reading ALT keys with bioskey in TC++?
From: dueck
Date: Mon, 31 Aug 1992 21:15
Date: Mon, 31 Aug 1992 21:15
25 lines
1469 bytes
1469 bytes
In article <1992Aug25.184207.7825@lclark.edu>, harrison@sun.lclark.edu (Mark Harrison) writes:
>
> Hi. I am reading ALT+<key> from the keyboard with bioskey (in TC++ 3.0.)
> But that gives me values that map to the physical layout of the keyboard.
> Is there an easy way to translate this value into one that will tell me
> the Ascii code of the key? For instance, how do I transform 0x3100
> (ALT+N) to get the ascii code of N? Will I need to write a function that
> will do this for all the ALT values I want to check for? If so, then no
> problem. I just don't want to reinvent any wheels.
>
The easiest way is to look at the keyboard status flags right after obtaining
a character from the keyboard. You can obtain them via interrupt 16, function 2.
This call returns the contents of 40:17 in AL. Bit 3 (mask 0x80) is set if an
ALT key is depressed. So:
if (kbhit()) {
ch = getch();
_AH = 2;
__emit__(0xcd, 0x16);
if (_AL & 0x08)
ALT was down
}
Gery Dueck
dueck@brandonu.ca
Technical Details
Message-ID:
<1992Aug31.151537.2189@brandonu.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!decwrl!access.usask.ca!ccu.umanitoba.ca!ciit85.ciit.nrc.ca!brandonu.ca!dueckReferences:
<1992Aug25.184207.7825@lclark.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!access.usask.ca!ccu.umanitoba.ca!ciit85.ciit.nrc.ca!brandonu.ca!dueck Newsgroups: comp.os.msdos.programmer Subject: Re: Reading ALT keys with bioskey in TC++? Message-ID: <1992Aug31.151537.2189@brandonu.ca> From: dueck@brandonu.ca Date: 31 Aug 92 15:15:37 CST References: <1992Aug25.184207.7825@lclark.edu> Organization: Brandon University, Brandon, Manitoba, Canada Lines: 25