SETKEY TYPED IN BY THE AUTHOR, EDITED BY PARASITE. The new command SetMap (V1.2) allows the use of different keyboards or the total reconfiguration of a keyboard! Alas, the only keymaps available are for foreign keyboards or the Dvorak keyboard. Wouldn't it be nice if you could reconfigure a keyboard to suit you needs? SetKey allows you to do just that and a whole lot more. SetKey is a keymap editor that allows up to eight strings to be assigned to most keys on the keyboard. Also characters can be entered in HEX so that maximum flexibility is maintained. The SetKey keymap editor is easy to use, easy to learn and best of all compatible with SetMap. SetKey can be used from WorkBench or the CLI. If SetKey is run from the CLI, a keymap that is stored in DEVS:keymaps/ can be used as an argument. If no keymap is specified then the current default keymap is used. When SetKey is run, it presents the user with a diagram of the keyboard with all the keys ready to be edited. Using SetKey starts with selecting a qualifier, if any, then a key to edit. For anyone unfamiliar with the concept of qualifiers, there are three qualifiers on the Amiga keyboard, shift, alt, and control. Any time that you hold one of the qualifier keys and press another key, the code which is sent to the computer includes the qualifier. This code is then translated by looking up (in the keymap!) the code and qualifier, and the translated code is finally sent to the application as a character or a string of characters. Since there is no restriction placed on the characters in the keymap, keys may "map" to strings containing carriage returns or other control codes, so that a single keypress can be made to perform several commands. In addition, qualifiers may be combined (e.g. shift+alt or shift+alt+control) making a total of eight different strings for each key. SetKey supports the mapping of all eight combinations with either characters or strings. Now that we have explained what SetKey does, lets examine how it works. To get familiar with SetKey, run the program from either CLI or WorkBench. First press the letter "a". Notice the a key on the keyboard picture is highlighted, and a box appears at the bottom of the screen with quite a bit of information in it. At the top of this box are three fields, indicating the key selected, its internal code value in hexidecimal, and any qualifiers currently selected. Note that the current display shows "none" for the qualifiers, since we did not press any qualifier keys before we pressed the "a" key. To indicate a qualifier, simply press the desired qualifier(s) BEFORE selecting the key you intend to edit. This action will highlight the qualifier(s) you select, and when you subsequently press a key to edit, you will see the qualifiers in the third field of the first line in the box. In the center of the box is a long string gadget containing the letter "a". There is a short string gadget in the bottom left corner, used for entering characters in hex. There are two more gadgets in the box, the "Modify Keymap" gadget and the "Cancel" gadget. Use the mouse to point at the Cancel gadget and press the select mouse button. The box will disappear and the a key will return to normal on the display. Now lets actually map a string to the shifted f1 key and test it in the CLI. First press any shift key on the keyboard (you may point at the keys in the display and press the select button on the mouse if you prefer). All the shift keys on the keyboard should be highlighted. Now press the f1 key (or point and click). The box will reappear at the bottom of the display with 4 characters in the long string gadget in the center of the box. The 4 characters should be an escape character (which Intuition displays in string gadgets as a tall box shaped character) then "10~". We are going to replace this relatively useless string with one that actually does something. First click in the long string gadget to activate it. The cursor will be displayed inside the gadget. Delete all the characters in the box and then type "cd df0:" without the quotation marks. Now we would like to set up our new shifted f1 to perform the cd df0: without having to press return after we press shift f1. To do this, we need to include the "return" at the end of our string. But pressing return now causes the display to blink and include a return in the string with the cursor placed one character to the right ready for more input. The hex entry gadget allows you to type in a hex number, which is translated into a character and placed in the string at the current cursor position, replacing whatever was previously there. Start by getting the cursor to the end of the long string gadget. Now point at the hex gadget and press the select button. The value displayed to the right of the hex gadget should change to 00. This is the value in hex of the character at the end of the string in the long string gadget. Type whatever HEX value you want, if any, at the current cursor location and hit return. Then click back on the string input gadget to continue input. Notice that a tall box appears at the end of the long string gadget. SetKey has replaced the 00 with the HEX value you have entered. Now that we have finished modifying the key, let's store it in the temporary working keymap by clicking on the Modify Keymap gadget. You may repeat this process for other keys on the display until you have the keys "mapped" according to your own preferences. The new keymap may now be saved by pulling down the Main Control menu and selecting "Save a keymap to the disk". When you do this, another box will be displayed with a directory string gadget and a filename string gadget in it. The directory string gadget points to DEVS:keymaps by default. This is the directory that setmap will look in later when we activate our keymap, so it is best to put all of your new keymaps here. Type in "example" in the filename gadget and click on the Save gadget. If your DEVS:keymaps disk has room and isn't write protected, the file will be stored. To exit, you may either click on the closewindow gadget or use one of the exit options from the main menu. Now we're ready to activate the new keymap. From the CLI, enter "setmap example". Your keymap has now been activated. To see it work, hold shift and press f1. The CLI should do cd df0: for you. Try out any other keys you have mapped. That's all there is to it. You are free to make further modifications by using SetKey again, but be aware that setmap will not replace a keymap which has already been activated. If you make changes with SetKey and store under the same name, setmap will simply reactivate your first version of the keymap. The only way to activate a new version with the same name is to reboot the Amiga and then do setmap again. The CopyKeys keymap, using the ARROW keys, provides a convenient way to run the Copy, DiskCopy, and Format commands. USE ARROW KEYS AS FOLLOWS: ALT + Lft Arrow - Sets up ramdisc by placing the Copy, DiskCopy, and Format commands in ram: ALT + Up Arrow - Formats a disk in drive df1: ALT + Rt Arrow - Copies all files from df0: to previously formatted disk in Df1: ALT + Down Arrow - DiskCopy from d0: to df1: ALT/Shift + Lft Arrow - Used to delete all files in ramdisc. The CopyKeys keymap, using the HELP key, provides a convienient way to utilize commands related to SetKey and the keymaps. USE THE HELP KEY AS FOLLOWS: Help - Reads this help file. Shift + Help - ShowKey command lists current keymap settings. ALT + Help - SetMap command allows user to change to another keymap. ALT/Shift + Help - Runs SetKey utility. The EdKeys keymap, using the ARROW keys, provides a convenient way to run Ed. USE KEYS AS FOLLOWS: SHIFT + Lft Arrow - Begin/End of line. SHIFT + Up Arrow - Up a Screen. SHIFT + Rt Arrow - Begin/End of line. SHIFT + Down Arrow - Down a Screen. ALT + Lft Arrow - Word Forward. ALT + Up Arrow - Top of File. ALT + Rt Arrow - Word Backward. ALT + Down Arrow - Bottom of File. The EdKeys keymap can also provide macro capability to standard Ed. Help - Open New Line. Enter - Autoindent (Macro for use with standard Ed). F1 - Quit. SHIFT + F1 - Save and Exit. This is just a start of all of the Possiblities of SetKey. SETKEY MAIN CONTROL MENU OPTIONS: Select View or Change mode: In "View" mode setkey simply displays the current mapping of any key which is selected. "Change" mode allows you to change the mapping of the keys. Load a keymap from the disk: Loads a keymap for editing. Save a keymap to the disk: Saves your current changes. End keymap editing: You may exit and execute setmap to set your work as the active keymap or exit without setting this map by choosing one of the suboptions. SHOWKEY: Showkey is a very simple utility which examines all the keys in the current default keymap and prints a paginated listing of the keys which have non-escape strings mapped to them. This can be quite helpful if you have trouble remembering how you mapped the keyboard. This version will detect keymaps that have keys with strings that are too long (ie > 127). TECH NOTES: Each string mapped to a key may contain up to 127 characters. The total for any key (all qualifiers) must be less than 256. This is not really a handicap in actual operation, it's just implicit in the way the C=A keymap structure is designed. Dead keys are NOT supported by SetKey. What ARE dead keys?? We had a hard time figuring it out too. Suffice to say, they are unnecessary, but if you really need them, there's always the usa keymap. Sometimes when you change back & forth between the hex gadget and the string gadget you'll notice the cursor will disappear. Intuition seems to toggle the cursor status whenever RefreshGadgets is called, causing the cursor to disappear. If you begin typing into the gadget, though, the cursor will reappear and remain until you deselect the gadget. Setmap runs down the keymap resource list (in RAM) to see if a copy of the keymap you have requested is already loaded. If it finds a match, it simply sets it as the current keymap for the task which called it. This is good and bad. It's good in that it saves time if he can find it in RAM. It's bad because there is no way to replace a keymap once it has been added to the resource list (at least not safely, because deleting it from the resource list without knowing whether or not it is being used at present by another task could be disastrous). But that's the way it works. Needless to say by now, SetKey ONLY works with V1.2 of AmigaDos! The ZorkKeys keymap is setup to make playing adventure games easy and fun. /********** Current Key Assignments **********/ Key : Qual : String : Comment ----------------------------------------------- keypad 0 : none : d : Down keypad 1 : none : sw : SouthWest keypad 2 : none : s : South keypad 3 : none : se : SouthEast keypad 4 : none : w : West keypad 5 : none : u : Up keypad 6 : none : e : East keypad 7 : none : nw : NorthWest keypad 8 : none : n : North keypad 9 : none : ne : NorthEast up arrow : none : n : North down arrow : none : s : South rt arrow : none : e : East lft arrow : none : w : West f1 : none : again: Repeat last command f2 : none : wait : Wait f3 : none : save : Save f4 : none : restore Restore This keymap can be tailored to your current game with SetKey. Warning: There is a bug in SetKey that will cause a guru if you have any fast ram (anything more than 512K) in your Amiga and select "Load a Keymap from the Disk" from the menu. You can edit the keymap that is currently in use when you start up SetKey, but if you want to load another keymap from disk to edit, turn off your fast ram first or you'll see the guru. This bug does not affect your later use of the altered keymap at all, it is just a bug with this one menu item. After exiting SetKey you can turn your fast ram back on. PROGRAM DISCLAIMER: The program is provided "AS IS" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the results and performance of the program is assumed by you. Should the program prove defective, you assume the entire cost of all necessary servicing, repair or correction.