Dec 082017
KB Macro Creation Program with C Source.
File KEYS.ZIP from The Programmer’s Corner in
Category C Source Code
KB Macro Creation Program with C Source.
File Name File Size Zip Size Zip Type
INKEY.C 1408 428 deflated
KEYFILE.C 2304 982 deflated
KEYFILE.EXE 6656 3537 deflated
KEYS.DOC 2304 1060 deflated
KEYS.H 768 247 deflated

Download File KEYS.ZIP Here

Contents of the KEYS.DOC file

* *
* Key recognition macros & functions courtesy of Dr. Bob -- 1985 *
* *
****************************************************************************** *

These files help make recognizing IBM's 'special' keys from a C program a
little more painless. The more commonly used macros (by me anyway) are
included in the file KEYS.H. If there are ones missing that you would like
to add, just run KEYFILE.EXE. This will create the file KEYS.NEW with the
new macros. You can then append KEYS.NEW to your KEYS.H file.

KEYFILE will prompt you to enter a macro followed by the key it
represents. For example, if you enter ALT_Q for the macro and then press
the and keys together, the following line will be added to the
file KEYS.NEW:

#define ALT_Q 144

The source to KEYFILE.C is included in case you want to see what's going on.

To use these macros your program needs to call inch() or kb() which
are included (source code) in the file inkey.c. inch() waits for a keypress,
kb() polls the keyboard without waiting (it returns 0 if no key has been
pressed). These functions return the ASCII value of the key pressed or
(if the key has an extended code) the code of the key with the high bit set.
If the code > 127 then your program knows that a special key has been
pressed. This includes all function key combos, cursor control pad, Ins,
Del, and all ALT key combos (but not Ctrl A - Ctrl Z).

c == inch();

if (c > 127) {

if (c == ALT_PGUP)

if (c== ALT_PGDN)

/* etc. */

} else putchar(c);

kb() uses the Aztec library bdos() call, be sure it matches your
library's version in format (or modify it accordingly).

Dr. Bob

 December 8, 2017  Add comments

Leave a Reply