Key Map Editor Tim Friest March, 1989 version 1.0 *************************************************************************** * The KeyMapEditor is copyright © 1989 to Tim Friest * * * * this program is FREE, you may copy it or distribute it as long as there * * is no charge for the program (small handling fees are allowed if this * * program is distributed on a disk with other PD/FreeWare/ShareWare * * programs or on a charge BBS), the executable is unaltered and this * * file accompanies it. * * * * please send any and all comments and/or bug reports to: * * * * USMail: Tim Friest bitnet: AXTBF@ALASKA.BITNET * * 3861 Steller Dr * * Anchorage, AK 99504 bix: TFRIEST * * * * Voice: (907) 337-5108 * * * * Compiled with Lattice C 5.02 * * * * tested on: B2000 rev 4.3, ROMs v1.3, NTSC, 3Mb RAM, AmigaDOS v1.3 * * * *************************************************************************** Introduction: KeyMapEd allows you to modify the KeyMaps destributed by Commodore-Amiga with AmigaDOS. These KeyMaps may then be installed on your system with the SetMap command. Basically, any key may have 'key macros'. Each key may have a seperate value for pressing the key alone, with shift, with alt, with shift & alt, with control, with control & shift, with control & alt, and with shift, alt, & control (the latter is refered to as vanilla). Thus, each key may have up to 8 seperate values when pressed. Further, keys may be capsable (use the shift value when the caps lock key is on) and/or repeatable (key repeats when held down). Finally, pressing the combination of a dead key with a key that is deadable (modified by a dead key) allows the addition of accents to the key value (for instance an 'alt-g' then 'a' will produce an 'à' or an 'a' with an accent grav above it). Any program which is written correctly and uses the default keymap will fully support all these features and fully support any changes you make to your keymap. Unfortunately there are many programs which are not written correctly and/or do not use the default keymap (hint! hint! developers!!!). I believe that with this utility, it will be much easier to write a program which uses a special keymap, and still fully support the keymap capablities, then to hardcode what each key does within the progam. Note: SetMap adds the keymap to a list in memory and if you do SetMap usa1 SetMap f SetMap usa1 SetMap will only read usa1 once! Further, usa1 and f will both remain in memory until you reboot. This impacts KeyMapEd since modifying a keymap that you've already done a SetMap on, then trying to SetMap it again, will not update the keymap in memory (it will just use the version it had already loaded into memory). You would have to save the keymap out under a different name from KeyMapEd to get SetMap to use the new version. The name is hardcoded in the file, so it is recommended you do not rename the file. The reason for this is that SetMap compares the name within the file to the keymap that is requested, and if it is the same, the version already in memory is used. Supose you edited the usa1 keymap, saved it as usa1 and then renamed it to foo. Then you changed your Startup-Sequence to do a SetMap foo instead of SetMap usa1 (which is normal for A500/A2000s). The system still thinks that the keymap it has loaded is usa1 (not foo) since that was the name coded in the file... For this reason, doing a SetMap usa1 will not load in usa1, but use the one in memory (which is really foo). Also, SetMap foo will load another copy of foo into memory since foo doesn't match usa1. Description: There are four basic types of keys definable within a keymap. NOP A NOP key does nothing, and has no value. Normal (NoQual) A normal key may contain up to 4 single character values (plus a special value for vanilla keys). This format uses the least amount of space, so you should use this if possible (as apposed to the next two). The four values can correspond to any combination of the key alone with up to two of the shift/alt/ctrl combinations. If you want the key to be vanilla, the ctrl key modifies the value of certain alphabetic keys plus some others (@ for example), giving you 5 values for that key. For example the 't' key contains the values 't', 'T', alt-t '\xfe', alt-T '\xde', and ctrl-t '\x14' (note the ctrl-t value isn't actually stored, it is calculated). String A string key may contain all 8 possible values, and each value may be up to 32 (as of AmigaDOS v1.3) characters in length. A good example of string keys are the function keys, the arrow keys, or the application keys. These keys will send a string whenever the key is pressed. This is basically what will give you that 'key macro' capability. Any key which is not dead or deadable may be string and output up to 8 different 32 character values when pressed. Therefore, if you want alt-f10 to issue a 'list dh0:" command you could simply code that into the keymap. Dead Dead keys output up to a single character in one of three ways. A key that is dead (when you press it it modifies the value of the next key pressed), a key that is deadable (modified by a dead key), and a key that is uneffected by a dead key. If a key is dead, it contains the value of the accent that it will use (for instance alt-k will produce an umlat with deadable keys). If a key is deadable, seperate values will be stored for each possible accent available on that key (there are currently five: accent accute (´), accent grav (`), caret (^), circumflex (~), and umlat (¨) (I produced these by pressing alt-f space, alt-g space, alt-h space, alt-j space, alt-k space with the USA1 keymap)). Finally, if the key can not be modified by a dead key, then simply place the value in the keymap (for instance an alt-a is not modified by a dead key). Using KeyMapEd: KeyMapEd will prompt for a keymap if you do not specify one. It auto- matically assumes the keymap is located in devs:keymaps so you must specify the full pathname if it is not located there (SetMap requires the keymap be in devs:keymaps so you might as well put them there anyway). The KeyMapEd window is very similar to KeyToy and should display the current value for each key with the current combination of shift/alt/ctrl/capslock. Simply press the shift/alt/ctrl/capslock gadgets to change the display. The keyboard displayed is that of an Amiga 2000. The keymap for an Amiga 500 or 1000 is exactly the same! The A2000 keyboard has a few additional keys that the A1000 did not, and some of the keys have migrated, but other then that, the keymap for ALL keys on the A1000 keyboard is exactly the same as that for an A2000, there are just fewer values on the A2000 keyboard listed as unused (i.e. there are still spaces left so an A3000 might very well have even more keys then the A2000 and still be fully compatible with the A1000 (at least keymap wise)). Clicking on a key gadget other then the shift, alt, ctrl, or capslock will display the key editor window for that key. The top row of gadgets define what type of key this is (NOP, Normal, String, or Dead). The second row shows which of the shift/alt/ctrl keys effect this key. The third row displays whether the key is capsable and/or repeatable. Finally the rest of the window shows the values for each of the shift/alt/ctrl combinations available for this key. The rest of the window will be different depending on whether the key is NOP, Normal, String, or Dead. Values for a key will be displayed in standard C string format. This means that if the value is normally printable, the value should appear, otherwise the hex value for the key will be displayed in the format '\x##'. A few notable exceptions to this rule are certain of the common control codes have special values '\r' for return, '\n' for newline, '\f' for formfeed, etc. Finally, since the '\' is used as an introducer for the control sequences, you must use '\\' to specify a single backslash. Since up to 4 characters may be used to specify a single character value, the string gadgets for a single value may hold up to 4 characters. Please note that Normal keys and dead keys may contain 1 and only 1 value, and if you place more characters in the string gadget then what will equate to a single character, the string will be truncated to 1 character. Likewise, String keys may only contain 32 characters, I have made the string gadget size 127 to hold many control sequences. Again, the resultant string will be truncated to 32 characters. Switching back and forth betwean the types of keys (NOP, Normal, String, and Dead) will produce strange results as strings are truncated to fit within certain limits or altered as dead or deadable keys. Selecting either the Use or Cancel gadgets will end the key edit mode and either update the keymap or not depending. Saving the KeyMap: Once you have gotten the keymap as you like, you will want to save it. Selecting the Save option from the Project Menu will give you a file requester which you may use to save the keymap either to the same filename as read or a new filename. Again the default directory is devs:keymaps, and you must specify otherwise if you desire it to be elsewhere. Note: The Key Map Editor uses the filename as the node name of the keymap, thus if you save a keymap as USA1 the system will not differenciate betwean the real (system) USA1 and your modified version, but if you save it as NEWUSA1, the system will always see it as NEWUSA1 even if you rename the file to USA1. This is important to remember because of the way SetMap works (see note at top).