home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
beehive
/
utilitys
/
chx8012b.arc
/
KEYBOARD.DOC
< prev
next >
Wrap
Text File
|
1990-07-21
|
10KB
|
193 lines
KEYBOARD MAPPING
CHECK REGISTER PROGRAM
CP/M-80 Version 1.2
August 1986
by WoolleyWare
Version 1.2 of the Check Register Program includes the ability to remap
CONTROL keys and to define how "special" keys, such as function and/or
arrow keys, should be interpreted by the program. The use of these
optional features is described in this document.
After installing the program using CHECKSIN, the CHECKS.SCR file
contains screen control information, which is described in detail on
pages 7 thru 9 of the Check Register Program document (v.1.0 dated June
1986 and found in the CHECKS.DOC file). The 17th line of CHECKS.SCR
defines Dloop and Inserton. The Dloop parameter expresses CPU speed as
a percentage of that for a Z80. Inserton should be non-zero for the
program to startup in insert mode when editing the Payee field.
Two additional parameters may follow Dloop and Inserton; they are
_Leadin and keymap. With these new parameters, the complete 17th line
now appears as follows:
Dloop Inserton _Leadin keymap
Each parameter is defined by the presence of a decimal integer value,
separated from other values by one or more spaces. The last two
parameters are optional. If decimal values are missing for both _Leadin
and keymap, they will each be set to zero. If _Leadin is given but not
keymap, then zero will be assumed for the latter.
If _Leadin is non-zero, then it will be taken to be the decimal ASCII
value received as the first of a series of characters transmitted when a
"special" key, such as a function key or an arrow key, is pressed. Up
to 10 special keys may be defined. They will be described on the 18th
line of CHECKS.SCR, which will be read into the _Funkey array. Each
special key may transmit up to three ASCII characters including the
common first character _Leadin. These special characters must be
received by the program with less than about one-tenth second delay
between each. (Timing is controlled by Dloop.) Once recognized, each
special key will be translated as described by the 19th line of
CHECKS.SCR, which will be read into the _Newkey array. If the special
characters are not recognized to be part of the _Funkey array or if they
are received too slowly, then they will be used by the program without
translation.
The _Funkey array may have up to 10 pairs of decimal ASCII values. Each
pair represents up to two ASCII characters to be received after _Leadin
when the corresponding special key is pressed; if only one character
will be transmitted by the special key, then the second value of the
pair should be zero. If less than 10 pairs are present on the 18th line
of CHECKS.SCR, zero will be assigned to remaining values, indicating
that they should be ignored by the program. Each _Funkey pair has a
matching _Newkey pair read from the 19th line; undefined _Newkey
parameters will be set to zero. Zero _Newkey values will be ignored by
the program. The process may be illustrated using the following
examples.
Many Televideo (and similar) terminals have a row of function keys
labeled F1, F2, F3, etc. Each transmits a series of three ASCII
characters beginning with SOH (which is CONTROL-A, or decimal ASCII 1)
and ending with CR (which is CONTROL-M, or decimal ASCII 13). The
middle character is @ for F1, A for F2, B for F3, etc. We will tell the
program to translate these keys as indicated below:
F1 F2 F3 F4 F5 F6 F7 F8
^KA ^KR ^O ^P ^KO ^KS ^KD ^KQ
where the carat symbol (^) indicates a CONTROL character. Lines 17, 18,
and 19 of the CHECKS.SCR file should be edited using a standard ASCII
text editor such as ED or WordStar in the Non-document mode. _Leadin
will be set to decimal 1. Notice that zero values will be assigned when
no additional decimal integer values are present on a line, which
permits text comments to be included without misinterpretation. Lines
17, 18, and 19 should be entered as follows:
100 1 1 Dloop Inserton _Leadin
64 13 65 13 66 13 67 13 68 13 69 13 70 13 71 13
11 65 11 82 15 0 16 0 11 79 11 83 11 68 11 81
When the special key should be translated into a single character, the
second value of the _Newkey pair must be set to zero, as illustrated.
For another example, the VT100 terminal includes arrow keys which
generate ESCAPE, [, and a letter from A thru D. These may be mapped as
follows:
Up Down Right Left Arrow key
ESC [ A ESC [ B ESC [ C ESC [ D Received characters
^E ^X ^D ^S Translated characters
The mapping may be defined by the following for lines 17, 18, and 19 of
CHECKS.SCR:
100 1 27 Dloop Inserton _Leadin
91 65 91 66 91 67 91 68 VT100 arrow keys
5 0 24 0 4 0 19 0 Program cursor controls
Notice that using the left arrow key will not transmit ^S (or XOFF) from
the VT100 terminal to the computer, which might otherwise cause problems
when XON-XOFF handshaking is used. Instead, ESC [ D is received from
the terminal then translated by the program into its move cursor left
command, which is ^S.
Finally, VT52 arrow keys are similar, except the [ character is not
present. They may be mapped using:
100 1 27 Dloop Inserton _Leadin
65 0 66 0 67 0 68 0 VT52 arrow keys
5 0 24 0 4 0 19 0 Program cursor controls
So much for _Leadin and "special" keys.
The fourth decimal integer value on line 17, if present, defines the
parameter keymap. A non-zero value indicates that a map (or table) will
be provided to redefine up to 32 CONTROL characters. This map will
consist of two lines in the CHECKS.SCR file, which will be read into the
_Keymap array. The first line maps the first 16 CONTROL characters
(decimal ASCII 0 thru 15), and the second line maps the second 16
(decimal ASCII 16 thru 31). If _Leadin is zero, then the values for
_Keymap must be provided on lines 18 and 19 of CHECKS.SCR; otherwise,
_Keymap will be read from lines 20 and 21.
Each entry of _Keymap defines how the corresponding CONTROL character
received from the keyboard should be translated before passing it to the
program. The first 16 entries correspond to ^@ (which is ASCII NUL),
^A, ^B, etc., thru ^O; the second 16 correspond to ^P thru ^Z, ^[, ^\,
^], ^^, and finally ^_. For example, if the first three entries in
_Keymap were 65, 66, and 67, then whenever ^@ was pressed, the program
would convert that into an A, ^A would become B, and ^B would result in
C. Each zero value in the _Keymap array indicates that the
corresponding CONTROL character should be translated into itself.
Therefore, if the second three entries in _Keymap were each zero, ^C
would be received as ^C, ^D as ^D, and ^E as ^E. Notice that, except
for ^@, a CONTROL character may not be mapped into ASCII NUL. (NUL is
often transmitted when the BREAK key is pressed.)
To illustrate, the Televideo 925/950 (and similar) terminals have arrow
keys which transmit the following:
Up Down Right Left
^K ^V ^L ^H
It would be convenient to translate these arrow keys as follows:
Up Down Right Left Arrow key
^K ^V ^L ^H Received character
^E ^X ^D ^H Translated character
The problem is that ^K and ^V are used by the Check Register Program for
other commands. To solve this problem, alternative CONTROL keys may be
mapped into ^K and ^V. For example, ^[ may be translated as ^K, and ^\
as ^V. The corresponding values for lines 17, 18, and 19 of CHECKS.SCR
would be:
100 1 0 1 Dloop Inserton _Leadin keymap
0 1 2 3 4 5 6 7 8 9 10 5 4 13 14 15
16 17 18 19 20 21 24 23 24 25 26 11 22 29 30 31
These values indicate that ^@ thru ^J should be translated into
themselves, ^K becomes ^E, ^L becomes ^D, ^M thru ^U are unchanged, ^V
becomes ^X, ^W thru ^Z are unchanged, ^[ becomes ^K, ^\ becomes ^V, and
the remaining three are unchanged. Notice that _Leadin is zero, so
_Funkey and _Newkey values are not supplied.
For a final example, the Televideo 912/920 and the Lear Siegler ADM-31
provide arrow keys which would be conveniently translated as follows:
Up Down Right Left Arrow key
^K ^J ^L ^H Received character
^E ^X ^D ^H Translated character
This is similar to the previous example except that ^J (LINE FEED) is
generated by the down arrow key instead of ^V. Unfortunately, the Check
Register Program uses ^J as its help command. For this example, we will
translate function key F1 into ^K and F2 into ^J using the following
input on lines 17 thru 21 of the CHECKS.SCR file:
100 1 1 1 Dloop Inserton _Leadin keymap
64 13 65 13 _Funkey table for F1, F2
11 0 10 0 _Newkey table for ^K, ^J
0 1 2 3 4 5 6 7 8 9 24 5 4 ^X, ^E, ^D
0 balance translated into self
To help you determine which decimal ASCII values are transmitted by the
special keys on your keyboard, a program written in Microsoft MBASIC has
been provided in the ASCII.BAS file. Its function is to display the
decimal value of each character received. This file contains standard
ASCII text, so it may be displayed using TYPE or a similar command. If
necessary, it should be fairly easily converted to another dialect of
BASIC or to any other language.