[comp.sys.ibm.pc] Determining Keyboard Codes

rrw@naucse.UUCP (Robert Wier) (03/28/89)

 I'm using an AT clone with a "BTC 5060" keyboard.  I wonder
 if there is a program which will tell me what keycodes are 
 being sent for any particular key when it is depressed?

 I'd like to know this so that I can make up a key map file for
 KERMIT which emulates a VT100 keyboard as closely as possible.
 For example, the top row of my keypad has (left to right) keys
 labeled Esc - Num Lock - Scroll Lock/Break - Sys Req/Reset, which
 I believe is fairly standard.  Are the keys like Num Lock hardwired
 into the system, or do they generate a code which can be remapped
 into an actual character sequence which can be sent to a host
 computer (in this case, a VAX)?  

 Thanks for any advice --


   - Bob Wier                                College of Engineering
  Flagstaff, Arizona                      Northern Arizona University
  ...arizona!naucse!rrw |  BITNET: WIER@NAUVAX | *usual disclaimers*

spolsky-joel@CS.YALE.EDU (Joel Spolsky) (03/29/89)

In article <1244@naucse.UUCP> rrw@naucse.UUCP (Robert Wier) writes:
>
> I'm using an AT clone with a "BTC 5060" keyboard.  I wonder
> if there is a program which will tell me what keycodes are 
> being sent for any particular key when it is depressed?
>
> I'd like to know this so that I can make up a key map file for
> KERMIT which emulates a VT100 keyboard as closely as possible.

In kermit you can issue the function "show key" to find out the scan
code and bindings for any bindable key. If you have 2.31 or later you
can actually bind more keys and combinations then BIOS would
ordinarily consider distinct.

It's in the manual, by the way.

+----------------+----------------------------------------------------------+
|  Joel Spolsky  | bitnet: spolsky@yalecs.bitnet     uucp: ...!yale!spolsky |
|                | internet: spolsky@cs.yale.edu     voicenet: 203-436-1483 |
+----------------+----------------------------------------------------------+
                                                      #include <disclaimer.h>

cs3b3aj@maccs.McMaster.CA (Stephen M. Dunn) (03/30/89)

   There are (as far as I know) two ways of finding out what keys have been
pressed if you are writing in assembly language or a language which can do
software interrupts; if you're trying to modify existing software, you're
probably out of luck.  Anyway, here goes.

   One method is to get keystrokes with INT 16h function 0.  This returns the
ASCII code in AL and the scan code in AH; these scan codes are the same on
all PC-compatible keyboards.  (Note that this function waits for a key to be
pressed; use function 1 to check for key presses).

   The other method is to replace the machine's keyboard driver with one of
your own.  This involves intercepting int 9, which the keyboard generates
whenever a key is pressed or released.  However, this gets kinda messy and
will cause problems if you have another program in memory doing the same
thing (e.g. Sidekick).  If you want more info on this, you can probably
find some in the IBM PC Technical Reference Manual (or whatever they
call it).

Hope this helps.
-- 
======================================================================
! Stephen M. Dunn, cs3b3aj@maccs.McMaster.CA ! DISCLAIMER:           !
! I always wanted to be a lumberjack! - M.P. ! I'm only an undergrad !
======================================================================