Keyboard ======== HUNTER computers are supplied with a standard QWERTY keyboard, see :doc:`../hunter-operation/keyboard`. Electrical Re-Definition ------------------------ Keyboard keys are each equated to the characters they represent by unique numerical codes, as listed in :doc:`../appendix/ascii-character-set`. These values are defined according to the American Standard Code for Information Interchange (ASCII). The value returned to Basic in, for instance, an :doc:`../basic-functions/inchr` statement is the numerical equivalent of the key pressed. The ASCII definitions of each key for the keyboard are contained in 116 consecutive RAM locations named ``KEYBUF``. The upper shift keys are defined in the first 56 locations, followed by the 56 lower shift keys. These memory locations form a 'map' of the physical keyboard. On power up, the HUNTER automatically defines these locations to a standard configuration. However, the programmer has the option to be able to define special keyboard arrangements. The schematic of the keyboard, see :doc:`../appendix/keyboard-memory-map`, shows the value in ``KEYBUF`` for each key. As an example, consider the key fourth from the left on the top row. If it was required to program this key to be $ in upper case and S in lower case, two :doc:`../basic-functions/poke` operations would be required. :: POKE (KEYBUF),36 POKE (KEYBUF + 56),83 It is important to note that on powering up HUNTER, the keyboard will revert to the standard version. The programmer should define the special keyboard requirements at an early stage in the program and ensure that the re-definition occurs each time the program is run. The codes used by the special control keys are listed in :doc:`../hunter-operation/keyboard`. .. _function-keys: Function Keys ------------- There are eight programmable function keys. They may be used as a quick method of entering frequently used commands or functions, or as eight separate interrupt keys. Soft Keys ~~~~~~~~~ On entering the Basic interpreter, the bottom line of the LCD displays the default values. These may be changed at any time with the :doc:`../basic-functions/key` function as described in :doc:`../basic-functions/index`. The screen only displays the first four characters, although the string may be up to fifteen characters long. The display of the soft keys is entirely optional, but they are always active no matter whether they are displayed or not. This feature is controlled with the :doc:`KEY ON <../basic-functions/key>` and :doc:`KEY OFF <../basic-functions/key>` commands. Interrupt Keys ~~~~~~~~~~~~~~ The soft keys may be used to provide interrupts into Basic programs. The relevant Basic statements are: - ON KEY (n) GOSUB line No. - KEY (n) ON - KEY (n) OFF - KEY (n) STOP The interrupts are tested at the beginning of every Basic statement. Once a particular key has been pressed and has interrupted, then it cannot interrupt again, although other keys can still cause an immediate interrupt. However, one interrupt on a particular key can be held pending while its interrupt routine is executing.