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 ( [ 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 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: [ M or [ 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. MS-DOS Keyboard Installation ------ -------- ------------ B>a:debug turbo.com { call debug } -d4ce0,4ddf { display the empty key table } 0AD9:4CE0 02 8B 1E E4 02 2B DA 5A-5B C3 80 3E CF 02 00 74 ...d.+ZZ[C.>O..t 0AD9:4CF0 07 87 DA E8 F9 B5 87 DA-C3 01 0D 02 1B 44 01 FF ..Zhy5.ZC....D.. 0AD9:4D00 02 1B 43 01 FF 01 FF 02-1B 41 02 1B 42 01 FF 01 ..C......A..B... 0AD9:4D10 FF 01 FF 01 FF 01 FF 01-FF 01 FF 01 FF 01 FF 01 ................ 0AD9:4D20 FF 01 FF 01 FF 01 FF 01-FF 01 FF 01 FF 01 FF 01 ................ 0AD9:4D30 FF 01 FF 01 FF 01 FF 01-FF 01 FF 01 FF 01 FF 01 ................ 0AD9:4D40 FF 01 FF 01 FF 01 FF 01-FF 01 FF 01 FF 01 FF 01 ................ 0AD9:4D50 FF 01 FF 01 FF 01 FF 01-FF 00 00 00 00 00 00 00 ................ 0AD9:4D60 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4D70 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4D80 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4D90 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4DA0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4DB0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4DC0 00 01 0D 01 13 01 08 01-04 01 01 01 06 01 05 01 ................ 0AD9:4DD0 18 01 17 01 1A 01 12 01-03 02 11 13 02 11 04 02 ................ -e4cfb { enter values } 0AD9:4CFB 02.03 1B.1b 44.5b 01.44 FF.01 0AD9:4D00 02.ff 1B.03 43.1b 01.5b FF.43 01.05 FF.1b 02.5b 0AD9:4D08 1B.33 41.31 02.7e 1B.03 42.1b 01.4f FF.50 01.03 0AD9:4D10 FF.1b 01.5b FF.41 01.03 FF.1b 01.5b FF.42 01.05 0AD9:4D18 FF.1b 01.5b FF.33 01.33 FF.7e 01.03 FF.1b 01.4f 0AD9:4D20 FF.52 01.04 FF.1b 01.5b FF.35 01.7e FF.04 01.1b 0AD9:4D28 FF.5b 01.36 FF.7e 01.05 FF.1b 01.5b FF.33 01.32 0AD9:4D30 FF.7e 01.03 FF.1b 01.4f FF.51 01.01 FF.ff 01.01 0AD9:4D38 FF.ff 01.05 FF.1b 01.5b FF.33 01.34 FF.7e 01.03 0AD9:4D40 FF.1b 01.4f FF.53 01.01 FF.ff 01.01 FF.ff 01.05 0AD9:4D48 FF.1b 01.5b FF.31 01.38 FF.7e 01.05 FF.1b 01.5b 0AD9:4D50 FF.32 01.30 FF.7e 01.04 FF.1b 01.5b FF.32 01.7e 0AD9:4D58 FF.05 00.1b 00.5b 00.31 00.37 00.7e 00.05 00.1b 0AD9:4D60 00.5b 00.31 00.39 00.7e 00.05 00.1b 00.5b 00.32 0AD9:4D68 00.36 00.7e 00.04 00.1b 00.5b 00.33 00.7e 00.01 0AD9:4D70 00.ff 00.01 00.ff 00.01 00.ff 00.01 00.ff 00.01 0AD9:4D78 00.ff 00.01 00.ff 00.01 00.ff 00.01 00.ff 00.01 0AD9:4D80 00.ff 00.01 00.ff 00.01 00.ff 00.05 00.1b 00.5b 0AD9:4D88 00.32 00.31 00.7e 00.01 00.ff 00.01 00.ff 00.05 0AD9:4D90 00.1b 00.5b 00.32 00.38 00.7e 00.04 00.1b 00.5b 0AD9:4D98 00.31 00.7e 00.05 00.1b 00.5b 00.32 00.39 00.7e 0AD9:4DA0 00.04 00.1b 00.5b 00.34 00.7e 00.01 00.ff 00.00 -d4ce0,4ddf { check the new table } 0AD9:4CE0 02 8B 1E E4 02 2B DA 5A-5B C3 80 3E CF 02 00 74 ...d.+ZZ[C.>O..t 0AD9:4CF0 07 87 DA E8 F9 B5 87 DA-C3 01 0D 03 1B 5B 44 01 ..Zhy5.ZC....[D. 0AD9:4D00 FF 03 1B 5B 43 05 1B 5B-33 31 7E 03 1B 4F 50 03 ...[C..[31~..OP. 0AD9:4D10 1B 5B 41 03 1B 5B 42 05-1B 5B 33 33 7E 03 1B 4F .[A..[B..[33~..O 0AD9:4D20 52 04 1B 5B 35 7E 04 1B-5B 36 7E 05 1B 5B 33 32 R..[5~..[6~..[32 0AD9:4D30 7E 03 1B 4F 51 01 FF 01-FF 05 1B 5B 33 34 7E 03 ~..OQ......[34~. 0AD9:4D40 1B 4F 53 01 FF 01 FF 05-1B 5B 31 38 7E 05 1B 5B .OS......[18~..[ 0AD9:4D50 32 30 7E 04 1B 5B 32 7E-05 1B 5B 31 37 7E 05 1B 20~..[2~..[17~.. 0AD9:4D60 5B 31 39 7E 05 1B 5B 32-36 7E 04 1B 5B 33 7E 01 [19~..[26~..[3~. 0AD9:4D70 FF 01 FF 01 FF 01 FF 01-FF 01 FF 01 FF 01 FF 01 ................ 0AD9:4D80 FF 01 FF 01 FF 05 1B 5B-32 31 7E 01 FF 01 FF 05 .......[21~..... 0AD9:4D90 1B 5B 32 38 7E 04 1B 5B-31 7E 05 1B 5B 32 39 7E .[28~..[1~..[29~ 0AD9:4DA0 04 1B 5B 34 7E 01 FF 00-00 00 00 00 00 00 00 00 ..[4~........... 0AD9:4DB0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0AD9:4DC0 00 01 0D 01 13 01 08 01-04 01 01 01 06 01 05 01 ................ 0AD9:4DD0 18 01 17 01 1A 01 12 01-03 02 11 13 02 11 04 02 ................ -w { save to disk! } Writing 8A00 bytes -q { leave DEBUG } B> CP/-86 Keyboard Installation ------ -------- ------------ B>ddt86 { call DDT, do not give file } DDT86 1.1 -r turbo.cmd { read the file here } START END 0650:0000 0650:8BFF -d4c30,4d2f { show the empty key table } 0650:4C30 84 BA 5A 5B C3 53 52 8B 16 EC 03 8B 1E EE 03 2B ..Z[.SR........+ 0650:4C40 DA 5A 5B C3 80 3E D9 03 00 74 07 87 DA E8 1F B6 .Z[..>...t...... 0650:4C50 87 DA C3 01 0D 02 1B 44 01 FF 02 1B 43 01 FF 01 .......D....C... 0650:4C60 FF 02 1B 41 02 1B 42 01 FF 01 FF 01 FF 01 FF 01 ...A..B......... 0650:4C70 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 ................ 0650:4C80 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 ................ 0650:4C90 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 ................ 0650:4CA0 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 ................ 0650:4CB0 FF 01 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4CC0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4CD0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4CE0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4CF0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4D00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4D10 00 00 00 00 00 00 00 00 00 00 00 01 0D 01 13 01 ................ 0650:4D20 08 01 04 01 01 01 06 01 05 01 18 01 17 01 1A 01 ................ -s4c55 { start setting new values } 0650:4C55 02 03 0650:4C56 1B 1b 0650:4C57 44 5b 0650:4C58 01 44 0650:4C59 FF 01 0650:4C5A 02 ff 0650:4C5B 1B 03 0650:4C5C 43 1b { and so on (use dump below to see all values) } 0650:4C6F 01 5b 0650:4C70 FF . { stop, and } -d4c50,4c6f { check your work occasionally } 0650:4C50 87 DA C3 01 0D 03 1B 5B 44 01 FF 03 1B 5B 43 05 .......[D....[C. 0650:4C60 1B 5B 33 31 7E 03 1B 4F 50 03 1B 5B 41 03 1B 5B .[31~..OP..[A..[ -s4c70 0650:4C70 FF 42 { etc. etc. } 0650:4CFF 00 01 0650:4D00 00 ff 0650:4D01 00 . -d4c30,4d2f { check the final product } 0650:4C30 84 BA 5A 5B C3 53 52 8B 16 EC 03 8B 1E EE 03 2B ..Z[.SR........+ 0650:4C40 DA 5A 5B C3 80 3E D9 03 00 74 07 87 DA E8 1F B6 .Z[..>...t...... 0650:4C50 87 DA C3 01 0D 03 1B 5B 44 01 FF 03 1B 5B 43 05 .......[D....[C. 0650:4C60 1B 5B 33 31 7E 03 1B 4F 50 03 1B 5B 41 03 1B 5B .[31~..OP..[A..[ 0650:4C70 42 05 1B 5B 33 33 7E 03 1B 4F 52 04 1B 5B 35 7E B..[33~..OR..[5~ 0650:4C80 04 1B 5B 36 7E 05 1B 5B 33 32 7E 03 1B 4F 51 01 ..[6~..[32~..OQ. 0650:4C90 FF 01 FF 05 1B 5B 33 34 7E 03 1B 4F 53 01 FF 01 .....[34~..OS... 0650:4CA0 FF 05 1B 5B 31 38 7E 05 1B 5B 32 30 7E 04 1B 5B ...[18~..[20~..[ 0650:4CB0 32 7E 05 1B 5B 31 37 7E 05 1B 5B 31 39 7E 05 1B 2~..[17~..[19~.. 0650:4CC0 5B 32 36 7E 04 1B 5B 33 7E 01 FF 01 FF 01 FF 01 [26~..[3~....... 0650:4CD0 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 01 FF 05 ................ 0650:4CE0 1B 5B 32 31 7E 01 FF 01 FF 05 1B 5B 32 38 7E 04 .[21~......[28~. 0650:4CF0 1B 5B 31 7E 05 1B 5B 32 39 7E 04 1B 5B 34 7E 01 .[1~..[29~..[4~. 0650:4D00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0650:4D10 00 00 00 00 00 00 00 00 00 00 00 01 0D 01 13 01 ................ 0650:4D20 08 01 04 01 01 01 06 01 05 01 18 01 17 01 1A 01 ................ -w turbo.cmd { write your file to disk } -^C { leave DDT86 (AFTER writing) } B> Permissions ----------- This document, and the data structures implicit in the hex dumps listed herein, are contributed to the public domain. -- W. Kempton, 8 Jan 85 --------