Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdcsu.UUCP Path: utzoo!watmath!watnot!watdcsu!broehl From: broehl@watdcsu.UUCP (Bernie Roehl) Newsgroups: net.micro.pc Subject: Re: Help needed on Shift, control keys Message-ID: <1872@watdcsu.UUCP> Date: Thu, 14-Nov-85 09:21:33 EST Article-I.D.: watdcsu.1872 Posted: Thu Nov 14 09:21:33 1985 Date-Received: Fri, 15-Nov-85 04:10:21 EST References: <395@ihdev.UUCP> Reply-To: broehl@watdcsu.UUCP (Bernie Roehl) Organization: U of Waterloo, Ontario Lines: 33 In article <395@ihdev.UUCP> pdg@ihdev.UUCP (P. D. Guthrie) writes: > > Somewhere in the address-space of the IBM pc is a byte that indicates > the current status of all the shift keys on the keyboard, including > the normal-shifts, ctrl-key, scroll-lock, and num-lock keys. The best (i.e. most portable) way of doing this is to use the keyboard input routine in the rom (int 16h) to return the shift status byte: mov ah,2 ; function code for "return shift state" int 16h The result will be a byte in the AL register whose bits have the following meanings: INSERT | CAPS LOCK | NUM LOCK | SCROLL LOCK | ALT | CTRL | L. SHIFT | R. SHIFT INSERT means insert mode is active, the three LOCK keys mean that mode has been toggled (i.e. CAPS LOCK is ON), and the last four mean those keys are down at the time the call is made. In the original PC, this bye was stored at offset 17H in the ROM BIOS data segment (segaddr 40H). This may be different in different releases of the PC rom, it may be different in the XT, the AT and the JR, and will almost certainly be different in clones. You should therefore use method above rather than referring to the byte directly. (However, if you choose to, the byte at offset 18H has the following in it: INS DOWN | CAPS LOCK DOWN | NUM LOCK DOWN | SCROLL LOCK DOWN | HOLD | 0 | 0 | 0 Here, the bits all mean that the corresponding key is depressed. You could thus (if you really wanted to) use any of these keys as true "shift" keys. (This is probably not useful and almost certainly non-portable). Hope this helps; for more info, see the IBM technical reference manual.