Reassigning Keystrokes on the Atari Portfolio by Carl Koop This files explains how to use the file ANSI.SYS, which can be found either here in the Portfolio SIG or in and DOS 2.0 package, to create 'Hot Keys' so that any DOS command can be entered via a single keystroke or keystroke combination. The information contained in this file is applicable, not only to the Portfolio, but to any DOS with an ANSI.SYS available for it. I hope that you find this information useful and should you have any questions, I can be reached here on CompuServe. The ANSI.SYS file is an enhanced keyboard and display device driver which is available for DOS versions 2 and up. One of the more useful functions of the ANSI.SYS device driver is its ability to reassign values to individual keys on the keyboard. This can be especially useful if you tend to execute the same programs very often as it will enable you to load and start these programs with a single keystroke, similar to loading and starting the Portfolio's editor by pressing the 'Atari' key and the 'E' keys simultaneously. In order to reassign keyboard values you must first install ANSI.SYS into your system just as you would any other installable device driver (be sure to use a DOS 2.0 compatible ANSI.SYS file). This is done by modifying your CONFIG.SYS file so that the driver is installed automatically at boot time. For example, if your ANSI.SYS file is in your C:\DOS directory you simply add the following statement to your CONFIG.SYS file: device=c:\dos\ansi.sys Remember that in order for ANSI.SYS to be installed, and subsequently accessible, you must reboot after adding this line to your CONFIG.SYS file. Also worth remembering is that while installing ANSI.SYS can enhance your usage of your Portfolio, it will also use up some of the already precious, and somewhat limited memory available to you for program execution. Once ANSI.SYS has been installed into your system, you can now reassign standard keystrokes to new values. As is the case with all ANSI.SYS command sequences, reassignment sequences begin with an ESC (escape character) followed by a left bracket ([). The left bracket is followed by the ASCII code of the character of the key that is to be reassigned. This ASCII code is then followed by one or more additional ASCII codes. The key indicated by the first ASCII code will take on the value of the remaining ASCII codes in the command sequence. Each of the ASCII codes must be separated by a semicolon. Finally, the command sequence is terminated by a lower case 'p'. Before we get to an actual example, we must first learn how to enter an escape character into the command sequence since simply hitting the ESC key will not issue the appropriate code (when you do enter an ESC keystroke DOS will intercept it and immediately perform the processing that it feels is appropriate). We will use the DOS command 'PROMPT' to issue the escape sequence as that is the easiest method for our purposes. Now, finally, on to the example. Let's say that you want to be able to load and start a program called 'XTERM2' with a single keystroke, 'F1'. You would issue the following commands at the DOS prompt: prompt $e[0;59;"XTERM2";13p prompt The first line sends the command sequence, in this case the ESC ($e), the left bracket, the ASCII code for F1 (0;59), the additional ASCII characters (we used a shortcut and simply entered a double quoted string), the ASCII code for a carriage return (13) and then terminated the command with a lower case 'p'. The second command resets the prompt to the default. At this point you should be able to press 'F1' and XTERM2 should load and start. Pretty nice, huh? But what do you do if you want to pass a parameter through on the command that starts your program? Well since you probably do not want to set up a keystroke for every possible parameter the best thing to do is eliminate the carriage return (13) from the ANSI.SYS command sequence which will simply display the command to the screen when you press the appropriate keystroke and then enter the parameter manually along with a carriage return. To make this whole operation as simple as possible, you can create a batch file that contains all of the keyboard reassignment commands that you want to have and execute it automatically at boot time. The commands could just as easily be made a part of your standard AUTOEXEC.BAT file. There are a few items that you should keep in mind when creating your own keyboard reassignment command sequences. First, when you issue a reassignment command the key remains reassigned until you either reassign it again, or reboot your system, therefore be sure to select keystrokes that you can afford to 'lose'. For example, many of the Portfolio's built in applications utilize F1 through F5, if you reassign F1 as we did in the example above, even when you are in the editor, pressing F1 will result in the string 'XTERM2' being issued and not the standard F1 keystroke. When I reassign my keyboard, I typically use either the SHIFT or ALT keys in conjunction with the function key to avoid problems. Second, if you add keyboard reassignment command sequences to your AUTOEXEC.BAT file you will be forced to rename the AUTOEXEC.BAT file and before you reboot if you do not want the reassignments set up. My remedy for this is to keep a pair of .BAT files available on my C: drive, one to install the reassignments, and one to remove them. This way all I have to do is execute the appropriate batch file on the fly. Finally, you should keep in mind that ANY keystroke or combination of keystrokes can be reassigned. This can be dangerous if you enter your reassignment command incorrectly, so I advise you to be careful whenever you are doing reassignments. I have included a small table that shows the Extended ASCII codes for the various function key settings for your convenience, but you can find all of the other ASCII codes in just about any DOS manual (and a lot of other places too). I hope that you find this information useful and enjoyable. If you have any problems or questions regarding the use of the ANSI.SYS device driver for keyboard reassignment, please feel free to contact me via Compuserve. Carl Koop CIS ID: 73637,650 Extended ASCII Codes Key Code Key Code F1 0,5 F2 0,60 F3 0,61 F4 0,62 F5 0,63 F6 0,64 F7 0,65 F8 0,66 F9 0,67 F10 0,68 Shift/F1 0,84 Shift/F2 0,85 Shift/F3 0,86 Shift/F4 0,87 Shift/F5 0,88 Shift/F6 0,89 Shift/F7 0,90 Shift/F8 0,91 Shift/F9 0,92 Shift/F10 0,93 Ctrl/F1 0,94 Ctrl/F2 0,95 Ctrl/F3 0,96 Ctrl/F4 0,97 Ctrl/F5 0,98 Ctrl/F6 0,99 Ctrl/F7 0,100 Ctrl/F8 0,101 Ctrl/F9 0,102 Ctrl/F10 0,103 Alt/F1 0,104 Alt/F2 0,105 Alt/F3 0,106 Alt/F4 0,107 Alt/F5 0,108 Alt/F6 0,109 Alt/F7 0,110 Alt/F8 0,111 Alt/F9 0,112 Alt/F10 0,113