[76174,105] MACTER.KEY 23-Dec-84 5235 143 Keywords: MACTERMINAL PATCHS KEYS KEYCODES KEYPAD KEYBOARD MAPPING RESOURCES An explanation of how the resources are used in MacTerminal to map the individual keys into transmitted characters. Also outlined is the method for mapping keyboard keys into keypad keys. This file is for experienced bit twiddlers who want to change the behavior of MacTerminal to fit their needs on their particular host computer. - Jonathan E. Hardis [76174,105] ----------------------------------------------------------------------------- CUSTOMIZING MACTERMINAL 12/23/84 The following was posted to info-mac, a Macintosh news group on Arpanet. I have copied it by hand, and hopefully have not introduced any errors. Notes in brackets refer to my footnotes at the end of the document. From: lsr@apple.UUCP (Larry Rosenstein) Date: 4 Dec 84 01:35:37 GMT Organization: Apple Computer, Inc. After all the complaints about the MacTerminal keyboard, I feel compelled to post this message. The mapping between keycaps and ASCII characters is totally defined in resource files (of course)! Because of the way resources are found, it is possible to setup the keyboard mapping on a document-by-document basis, which is much better than having multiple copies of MacTerminal around. There are 3 resource types to consider. (In the following, I describe the contents of the resource in terms of a Pascal declaration.) (1) Type KCKI: PACKED ARRAY[KeyCode] OF KeyIndex, where KeyCode = 0..95 and KeyIndex = 1..71. This maps the standard keycode numbers into the range 1..71. [Note 1] (2) Type KICH: ARRAY[KeyIndex] OF Entry, where Entry = PACKED ARRAY[0..15] OF CHAR. This maps the KeyIndex and the state of the modifier keys into an ASCII character. (The modifier bits are in the same order as in the EventRecord.) [Note 2] (3) Type CHRT: PACKED ARRAY[Boolean, Char] of Boolean. This maps the state of the command key and the ASCII character (from (2)) into TRUE if repeating is allowed for that key if the Repeat Ctrls option is off. (I am not 100% sure about this, however.) There are 2 resources of each type; ID = 256 is for VT100/TTY mode and ID = 257 if for IBM mode. I was able to customize one of my documents by using RMover [Note 3] to copy the appropriate resources into the document, and using FEdit [Note 4] to modify them. NOTE: I believe this information is accurate, but I have not verified this with the MacTerminal authors. (So don't blame them or Apple if something goes wrong, blame me.) Good Luck, and Enjoy! Larry Rosenstein - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Note 1]: Keycodes are discussed in Event Manager section of Inside Macintosh. Quickly, each physical button on the keyboard and the keypad send a "Keycode" to the machine, which has nothing to do with what letter is printed on the key or any particular character set (ASCII or EBCDIC, for example). The key codes are, row by row on the keyboard: 50 18 19 20 21 23 22 26 28 25 29 27 24 51 48 12 13 14 15 17 16 32 34 31 35 33 30 42 00 01 02 03 05 04 38 40 37 41 39 36 06 07 08 09 11 45 46 43 47 44 Space Bar = 49, Enter = 52 And on the optional keypad: 71 78 70 66 89 92 93 77 86 87 88 72 83 84 85 76 82 65 [Note 2]: Option, Caps Lock, Shift, and Command keys do not generate keycodes. Instead, they make up, in that order, the four- bit (0-15) modifier field. For example, you should usually treat Caps Lock (4) and Shift (2) the same. Command/Shift would be represented as 3. [Note 3]: RMOVER can be found in DL 5. It is very buggy, and should be used with caution on backup copies only. [Note 4]: As of this writing, FEDIT is no longer in MAUG. The author has indicated that a new, improved version may be posted soon. It is a public domain program which may be found at your local Apple dealer or User Group on their public domain disks. REDIT (Resource Editor) is a newer program on DL 5 which can (in theory) do the same thing, and is easier since it knows how to find and display the particular resources in an orderly way. As of this writing, REDIT is in its first debut outside of Apple and is very buggy. Use with caution only on backup copies. It can (in theory) both edit and move resources between the MacTerminal application and individual MacTerminal documents. So what does all this mean? It means if there are characters you need to get to on the keyboard, such as the tilde (~) or rubout (found on many terminals and used a lot on DEC computers) you can change any key, with or without any combination of Option, Caps Lock, Shift, and Command, to transmit the correct code. It also means that you can map the keypad keys (if you don't have a keypad) into keyboard keys! For example, you can make Option-1 equal to 1 on the Keypad. (And I just bought my keypad two days ago. AARGH!) Instead of detailing for the novice on how to do all the patches, if you succeed in making good resources for a particular situation, such as a popular keypad editor on a popular computer, put the modified resources into a MacTerminal _document_ and upload the document. - Jonathan E. Hardis [76174,105]