home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / keyboard / keyutils.arc / KEYUTILS.DOC < prev    next >
Encoding:
Text File  |  1988-09-06  |  3.0 KB  |  93 lines

  1.                            KEYUTILS
  2.  
  3.      The file KEYUTILS.ARC contains three useful utilities - 
  4. SETKEY, RESETKEY and READKEY - and assembly language source 
  5. code.  The program KEYDISP is included to demonstrate the use 
  6. of READKEY.
  7.  
  8. ------------------------------------------------------------
  9. SETKEY
  10.  
  11.      This utility defines the functions keys 1-40.
  12.  
  13. Syntax:  SETKEY n text
  14.  
  15. Where:   n    - is a number between 1 and 40, inclusive.
  16.          text - is the text to be associated with the 
  17.                 function key.
  18.  
  19. Ex 1:  setkey 1 dir
  20.  
  21. Results:  The command DIR is executed when F1 is pressed.
  22.  
  23. Ex 2:  setkey 12 golotus
  24.  
  25. Results:  Executes the command GOLOTUS when the Shift-F2 
  26.           key is pressed.
  27.  
  28.  
  29. REQUIREMENTS:  The SETKEY command requires the ANSI.SYS 
  30.      driver to be installed.  The ESC sequence identifying
  31.      the key is added before "text" and a carriage return
  32.      is added afterwards.
  33.  
  34. Advanced feature:  A sequence of commands can be assigned to
  35.      a single key by adding the following between commands:
  36.  
  37.            ";13;"
  38.  
  39.      Note:  The quotes are required.
  40.  
  41. Ex. 3:  setkey 24 cls";13;"dir
  42.  
  43. Results:  The screen is cleared and the DIR command executed
  44.           when the CTRL-F4 key is hit.
  45.  
  46. Hints:  Assign keys that are used little (11 - 40) by other 
  47. applications.  For example, almost all programs use the F1-F10 
  48. keys, but few use the SHIFT, CTRL, ALT form of these keys.
  49.  
  50. -------------------------------------------------------------
  51. RESETKEY
  52.  
  53.      This utility resets the function keys to there previous 
  54. state.
  55.  
  56. Syntax:  RESETKEY n
  57.  
  58. Where:   n  - is a number between 1 and 40, inclusive.
  59.  
  60. Ex. 1:  resetkey 1
  61.  
  62. Results:  Resets F1 to previous setting.
  63.  
  64. Requirements:  ANSI.SYS must be installed to function 
  65.                properly.
  66. ------------------------------------------------------------
  67. READKEY
  68.  
  69.      READKEY is a subroutine which can be modified for Pascal,
  70. C, Basic, etc.  This program reads a key from the keyboard and
  71. returns its value in AX.  If the key entered is an extended 
  72. key, then the value in AX represents the scan code plus 1000.
  73. If the key was entered by holding the ALT key and entering the 
  74. ascii code from the keypad, then 2000 is added to ascii code.
  75.  
  76. Ex. 1:  If the letter "a" is entered from the keyboard, then
  77.         READKEY returns the value 97 in AX.
  78.  
  79. Ex. 2:  If the PgDn key is entered from the keyboard, then
  80.         READKEY returns the value 1081 in AX.
  81.  
  82. Ex. 3:  If the ALT-127 is entered, then 2127 is returned in 
  83.         AX.
  84.  
  85.      This makes it easier for a programmer to identify keys as 
  86. one code rather than a combination of two codes - the ascii 0 
  87. followed by the scan code.  For example, the PgDn key produces 
  88. an ascii 0 and 81 (0,"Q") sequence.  It also makes it possible 
  89. to distinguish between a code entered normally and those 
  90. entered by the combination ALT key and keypad.
  91.      The program KEYDISP displays the codes returned by 
  92. READKEY.  Hitting the space bar will terminate the program.
  93.