            Notes for KEYBOARD.PAS

This unit is intended to replace Turbo Pascal 7.0's built-in copies of ReadKey and KeyPressed.  Those functions can not detect keystrokes like ALT-ESC or ALT-?. The methods known by Keyboard's KeyInput object can.
Note that KeyInput.read does not return a character per se.  Instead, it uses a whole word to specify which key was pressed. The following format is used:

Bit number       Use
+-+
|0|
+-+
|1|
+-+
|2|
+-+
|3|
+-+              Ascii value
|4|
+-+
|5|
+-+
|6|
+-+
|7|
+-+

+--+
| 8|             an alt key was down
+--+
| 9|             a control key was down
+--+
|10|             a shift key was down
+--+
|11|             The key was on the numeric keypad
+--+
|12|             reserved
+--+
|13|             reserved
+--+
|14|             reserved
+--+
|15|             reserved
+--+

Please note that KEYBOARD.PAS declares a series of constants to represent keys in your programs.  This include all existing function keys, home, end, Page Up, and more.  That permits you spot what a key does by its name.
Also, KeyInput can tell the difference between CTRL-Return (ReturnKey + CtrlKey), return (ReturnKey), CTRL-M (CtrlKey + ord ('M'), and the various combinations involving the Numeric Keypad Enter (ReturnKey + NumericKey).
Never use KeyInput with Turbo Pascal's built-in keyboard routines.  KeyInput increases the size of the buffer by one keypress.  Whenever KeyInput.KeyPressed is called, any waiting keypress will be read into the buffer extension.  Once that happens, Turbo Pascal will not be able to get at it.
I have provided constants for F13 through F15 for your convienence.  However, this version of KeyInput will never return them.  (I did not know what scan codes to look for.)
KeyInput will correctly handle complex keystrokes like SHIFT-CTRL-ALT-F11 (ShiftKey + CtrlKey + AltKey + f11key) and SHIFT-ALT-Page Up (PageUpKey + ShiftKey + AltKey)
If you want your code to ignore a modifier key (shift, ctrl, alt) then use something like: KeyInput.read and not AltKey.  Never try to modify a keystroke by with + or -; that would destroy the code.  Also, never 'or' a key code with one of the modifer constants (ShiftKey, AltKey, CtrlKey).
If the user types any simple ascii value, then the shift bit will be 0.

Written by: Will Pittenger, 1124 Brentwood Rd, Morton, IL 61550-2646, (309)-263-2176