home *** CD-ROM | disk | FTP | other *** search
- (*****************************************************************************
- * *
- * Program: Keydefs.Inc *
- * *
- * Author: Richard R. Rebouche *
- * *
- * Update: 03/10/86 *
- * *
- * Purpose: This module will allow a Turbo Pascal programmer to read *
- * extended scan codes from the keyboard and to refer to special *
- * keys (like Control_F1) by using mnemonics (like Ctrl_F1). *
- * *
- * Usage: Include this file at the beginning of your program using the *
- * dollar-include compiler directive. {$I KeyDefs.Inc} *
- * *
- * Use the function GetKey to read a keystroke from the keyboard. *
- * GetKey returns an INTEGER value. If the value returned is *
- * less than 256, the key was a character, otherwise, it is a *
- * special key. *
- * *
- * The symbols (F1, Ctrl_F10, etc.) may be used in comparisons *
- * or assignments just like any other numeric constants. *
- * *
- *****************************************************************************)
-
- Const { Keyboard numeric equivalents }
-
- {*** Function Keys: Alone, with Shift, Control, & Alternate keys ***}
-
- F1 = $1B3B; Shft_F1 = $1B54; Ctrl_F1 = $1B5E; Alt_F1 = $1B68;
- F2 = $1B3C; Shft_F2 = $1B55; Ctrl_F2 = $1B5F; Alt_F2 = $1B69;
- F3 = $1B3D; Shft_F3 = $1B56; Ctrl_F3 = $1B60; Alt_F3 = $1B6A;
- F4 = $1B3E; Shft_F4 = $1B57; Ctrl_F4 = $1B61; Alt_F4 = $1B6B;
- F5 = $1B3F; Shft_F5 = $1B58; Ctrl_F5 = $1B62; Alt_F5 = $1B6C;
- F6 = $1B40; Shft_F6 = $1B59; Ctrl_F6 = $1B63; Alt_F6 = $1B6D;
- F7 = $1B41; Shft_F7 = $1B5A; Ctrl_F7 = $1B64; Alt_F7 = $1B6E;
- F8 = $1B42; Shft_F8 = $1B5B; Ctrl_F8 = $1B65; Alt_F8 = $1B6F;
- F9 = $1B43; Shft_F9 = $1B5C; Ctrl_F9 = $1B66; Alt_F9 = $1B70;
- F10 = $1B44; Shft_F10 = $1B5D; Ctrl_F10 = $1B67; Alt_F10 = $1B71;
-
-
- {*** Alphanumerics: With Alternate key ***}
-
- Alt_1 = $1B78; Alt_Q = $1B10; Alt_A = $1B1E; Alt_Z = $1B2C;
- Alt_2 = $1B79; Alt_W = $1B11; Alt_S = $1B1F; Alt_X = $1B2D;
- Alt_3 = $1B7A; Alt_E = $1B12; Alt_D = $1B20; Alt_C = $1B2E;
- Alt_4 = $1B7B; Alt_R = $1B13; Alt_F = $1B21; Alt_V = $1B2F;
- Alt_5 = $1B7C; Alt_T = $1B14; Alt_G = $1B22; Alt_B = $1B30;
- Alt_6 = $1B7D; Alt_Y = $1B15; Alt_H = $1B23; Alt_N = $1B31;
- Alt_7 = $1B7E; Alt_U = $1B16; Alt_J = $1B24; Alt_M = $1B32;
- Alt_8 = $1B7F; Alt_I = $1B17; Alt_K = $1B25;
- Alt_9 = $1B80; Alt_O = $1B18; Alt_L = $1B26;
- Alt_0 = $1B81; Alt_P = $1B19;
-
- Alt_Minus = $1B82;
- Alt_Equal = $1B83;
-
-
- {*** Cursor Keypad: Alone & with Control key ***}
-
- Home_Key = $1B47; Ctrl_Home = $1B77;
- End_Key = $1B4F; Ctrl_End = $1B75;
- PgUp = $1B49; Ctrl_PgUp = $1B84;
- PgDn = $1B51; Ctrl_PgDn = $1B76;
- Up_Key = $1B48; { Ctrl_Up is not returned by BIOS }
- Down_Key = $1B50; { Ctrl_Dn is not returned by BIOS }
- Left_Key = $1B4B; Ctrl_Left = $1B73;
- Right_Key = $1B4D; Ctrl_Right = $1B74;
-
-
- {*** Miscellaneous Special Keys ***}
-
- Esc_Key = $001B;
- Tab_Key = $0009; Shft_Tab = $1B0F;
- Back_Del = $0008;
- Return = $000D;
- Space = $0020;
- Ins_Key = $1B52;
- Del_Key = $1B53;
-
-
-
- { Function: Wait for a keystroke, return it as an integer value. `Special' }
- { keys are returned as 27 * 256 + Scan Code. }
-
- Function GetKey : Integer;
-
- Var C : Char;
- I : Integer;
- A : Array [0..1] of Char Absolute I;
-
- Begin
- I := 0;
- C := #0;
- Read (Kbd, C);
- If (C = #27) And Keypressed then
- Begin
- A[1] := C;
- Read (Kbd, C);
- End;
- A[0] := C;
- GetKey := I;
- End;
-
- {*** End of Key definition include file ***}
-
-
-
-
-
-