Defining the DEC Rainbow Keyboard for Turbo Pascal
Willett Kempton
8 January 1985
Turbo Pascal is great! But who can remember those stupid WordStar
commands? This document shows how to define the entire Rainbow
keyboard so the Turbo editor recognizes it. Why bother? Easier
to remember. Faster typing. Less confusing to switch to Turbo from
word processors and other programs which use the same function keys.
Easier to train new staff.
The Borland TINST program is supposed to allow customizing the
TURBO editor to the keyboard of your computer. The Turbo manual
says that keycodes are limited to four characters, but in fact
with more than three characters, TINST beeps and does not define
the key properly. For example, the Rainbow "next screen" key
generates four characters ( <esc> [ 6 ~ ), so TINST cannot define
that key to do anything useful. All but 8 of the Rainbow's
function keys generate more than three characters.
The restriction to three characters is not imposed by TURBO
itself, but only by the TINST program. TURBO imposes the
restriction that all the key definitions together not exceed 153
characters, which is the size of its table defining these keys.
The three-character TINST limit can be circumvented by entering
key values into a table in the TURBO program directly, with DDT86
or DEBUG, thereby defining any length of keys desired.
A Proposed Set of Keys
----------------------
After experimenting with several different keyboard definitions, I
settled on the one described below. Key names are logical, as
much as possible. In a moment of foolishness, I even made up a key
strip for these definitions. The block commands remain available
only as the original WordStar keys (^K^B, etc). The method
described below can be used to define any other set of keys, if
the following is not desired.
Rainbow key Turbo function
----------- --------------------
<-- 1. Character left
--> 3. Character right
F17 4. Word left
PF1 5. Word right
Up arrow 6. Line up
Down arrow 7. Line down
F19 8. Scroll up
PF3 9. Scroll down
Prev Screen 10. Page up
Next Screen 11. Page down
F18 12. To left on line
PF2 13. To right on line
F20 16. To top of file
PF4 17. To bottom of file
Resume 20. To prior cursor position
Main Screen 21. Toggle insert/overwrite mode
Insert Here 22. Insert line
Interrupt 23. Delete line
Cancel 24. Delete to end of line
Addtnl Opts 25. Delete right word
Remove 26. Delete character under cursor
Exit 38. End edit
Help 41. Restore line
Find 42. Find
Do 43. Find and replace
Select 44. Repeat last find
^K^B 29. Mark block begin
^K^K 30 Mark block end
^K^C 33. Copy block
^K^V 34. Move block
^K^Y 35. Delete block
^K^R 36. Read block from disk
^K^W 37. Write block to disk
Keystrip Template
-------- --------
- print at 10 cpi (DEC LA-34/50/100 will change r and o to lines)
- cut off lines and "X"es, tape three strips into one
X(0rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(B
X Hold Print Set-up F4 Break Delete Prior Delete Insert/
X Screen Screen Line Cursor to eol Overwr
X(0ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(B
(0rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(B
Insert/ Exit TURBO <ESC> BS LF Delete Restore Search
Overwr PASCAL word Line Replace
(0oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(B
(0rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr(BX
Search and Word Line Scroll File X
Replace F/PF l/r l/r u/d t/b X
(0oooooooooooooooooooooooooooooooooooooooooooooooo(BX
Screen Installation
------ ------------
Before working with the keys, use TINST to finalize the screen installation
to something satisfactory. On early releases, delete line was wrong.
Delete line should be: <esc> [ M or <esc> [ 1 M
Also in TINST, you may want to disable START HIGHLIGHTING. This is because
whatever Turbo considers "highlighting" is sent to the console by every
Pascal program generated by the compiler, even if the program does no console
I/O whatsoever!! (If PIP or COPY were written in Turbo Pascal, they would
make the screen go bold every time they were run.) Disable by typing "-".
The disadvantage is that in the editor, control characters will not appear
to be different from other characters, and blocks arent visible--minor
disadvantages, in my opinion, compared to having every program toggle the
screen brightness.
Once you have the screen set the way you want it, you are ready to
install the keyboard.
How to Enter the Key Values
--- -- ----- --- --- ------
Using DDT86 or DEBUG, look for the table at the memory locations
listed below.
Operating system Turbo version Table starts at
-------------- -------- -----
CP/M-86 2.00B 4C55
CP/M-86 2.10A 4DD5
MS-DOS 2.00B 4CFB
If you have a version other than one of those listed, find the
table by looking for the repeating 01 FF 01 FF 01 FF pattern --
you can't miss it. The first few predefined key entries start
with hex values: 02 1B 44 01 FF 02 1B 43 etc (see examples below).
They show as ..D....C......A..B. This is where you start putting
in your keys. The new keys must be entered in the same sequence
as in the TINST program. Any keys to be skipped are entered as
"01 FF". Each table entry begins with the length of the key.
Also, note that the bottom of the dumps show the original WordStar
key definitions in a second table. These are unchanged and continue
to be valid as alternative keys. (I couldn't find this table in
the CP/M-80 version.)
In the examples below, d is used both by MS-DOS and CP/M-86 to
dump memory (show a block). DDT86 reads the file with "r", while
DEBUG gives it on the command line. Memory values are changed by
"s" on DDT86, which sets one value per line, and by "e" on DEBUG,
which allows 8 values per line. Be sure to check with another
"d", and to save with "w", before leaving the program. This
procedure is a bit tedious; it goes much faster with two people,
one reading the values.
Since it is easy to make mistakes when entering values via DDT or
DEBUG, this procedure should be done on a spare disk copy of
TURBO, and all keys should be tested before it is put into routine
use. I found that when a five-key sequence was used for Turbo
function 44, 'repeat last find', it did not work; replacing it
with a four-key sequence solved the problem. Any further key
refinements have to be made with DDT86 or DEBUG; if you ask TINST
to redefine these long key sequences, it gets very confused (it can
still change screen values correctly). This key system has be in
routine use at three sites for 6 months, and has worked perfectly.
Footnote: These keys even work in remote mode! e.g. On one Rainbow
run CTTY \AUX (under MS-DOS) then set your modem to auto-answer.
From a second Rainbow (or VT220), call the first. You can now edit
and run programs on the first Rainbow, using the Turbo editor and all
the defined function keys.