Classic Computer Magazine Archive COMPUTE! ISSUE 92 / JANUARY 1988 / PAGE 84

Softkey For Atari XL/XE

John Oakley And Earl R. Davidson

Take control of your computer keyboard with this impressive macro program—the best one we've published for the Atari. Included is a powerful macro editor. For the Atari XL/XE series of computers with a disk drive.

"Softkey" is a keyboard macro program for Atari XL and XE computers (except for the 1200XL) that's compatible with many programs, including Atari BASIC, AtariWriter, SpeedScript 3.0, DOS 2.5, and DOS XL from OSS. Softkey allows you to redefine keys any way you wish.

If you plan to use Softkey with BASIC, you can redefine keys to aid you in writing and debugging your programs. For instance, you might want to define Shift-Control-S as SAVE"D:. Then, whenever you want to save your program, just press Shift-Control-S and type the filename, then press RETURN.

Softkey can be even more useful with a word processor. Suppose you're writing an essay about Wuthering Heights, a novel by Emily Bronte. Define Control-W to be Wuthering Heights, Control-H to be Heathcliff, Control-C to be Catherine, and Control-B to be Bronte. One keystroke is all you need to get any of these names.

The best thing about Softkey is that you don't need to be a programmer to use it—a complete macro editor is included.

Typing It In

Softkey consists of two programs—the first is a BASIC program that creates a machine language program on disk. The second is the Softkey Editor, which is written in BASIC. Using "The Automatic Proofreader" program, located elsewhere in this issue, type in both programs and save them to disk. When you save the programs, use the name SKCREATE for Program 1 and SKEDIT for Program 2. Program 2 has many special characters. Be sure you read and understand the typing instructions in the "COMPUTE!'s Guide to Typing In Programs" article elsewhere in this issue. In particular, the vertical line character (!) is obtained with the SHIFT-= key combination. Characters enclosed in braces, {}, are typed by holding down the CTRL key while typing the indicated keys.

Next, load Program 1 and run it. The program will ask you the name of the file you wish to create. Respond with the name AUTORUN.SYS. The machine language Softkey program will be written to disk. If your disk already has a file named AUTORUN.SYS on it, you probably don't want to overwrite that file with the Softkey program. Instead, format a new disk, write the DOS files to it (and the RAMDISK.COM file, if you have a 130XE), copy SKEDIT to the disk, and finally run SKCREATE and specify AUTORUN.SYS.

Now, run SKEDIT (Program 2). You'll see the following list of commands:

Edit Key

Load

Save

Clear

Auto Key

View All

You can move up and down among the commands with the cursor keys. Press RETURN to select a command. Alternatively, commands can be selected by typing the first letter of the command. To the left of the commands is the file selector box, which becomes active when you select the Load command. The box to the right of the commands (labeled Current File) is a status box, which keeps track of the number of keys defined, the amount of memory used, and which key (if any) is defined as the Auto Key.

Let's define a key. Select the Edit Key Option by pressing E. Now press the key combination that you wish to define. You can define Control and Shift-Control combinations, so Control-B and Shift-Control-B can perform different actions. We will define a shortcut for saving to disk. Press Shift-Control-S. Now type SAVE"D:. Press SELECT to store your macro. If you wish to define other keys, define them now. If you want one of your key definitions to execute automatically when you boot the disk, choose that key as the Auto Key with the Auto Key command.

When you're ready to save your key definitions, select the Save command. Enter the name DEFAULT.SOF. This is the name of the file which is loaded by the AUTORUN.SYS program. Reboot your computer by turning it off and back on. The Softkey program loads into memory. If you selected an Auto Key, it executes automatically. Try out your keyboard macro by typing Shift-Control-S. SAVE"D: should appear on the screen.

Softkey can be disconnected by typing Shift-Control-Escape. This should be done whenever you run SKEDIT to edit your macros. Pressing Shift-Control-Escape again reactivates Softkey.

Editor Features

Since the Caps key can be used as a macro key, press HELP and Shift-HELP to turn caps on and off. Press OPTION to delete the last key pressed (pressing delete won't work, since macros can be assigned to it). Press START to abort the editing of the current key. Press SELECT to enter a new definition.

You may want to keep a collection of macro files on a disk with descriptive filenames. Whenever you want to use one of the macro files, simply rename it to DEFAULT.SOF.

Key Redefinition

Softkey allows dynamic key redefinition. This means you can redefine any key without rebooting. As an example of this powerful feature, we'll redefine the Shift-Control-S key to print SOUND. Note that the new definition must have the same number, or less characters than the original definition.

Press Shift-Control-A to redefine a key. The border color should change to red. Now press the key you wish to redefine—in this case Shift-Control-S. The border should change to light purple, indicating that you've chosen a valid macro key. Now type SOUND. Press Shift-Control-A to end macro redefinition. You may wish to define several strings of spaces in the macro editor. These blank definitions can then be redefined whenever you need them. Note that there is no way to save the keys redefined by Softkey's redefinition mode.

Compatibility

Softkey is compatible with many programs. As an example, consider SpeedScript 3.0, COMPUTE!'s popular word processor. Format a new disk and copy the Atari DOS files onto it. Now, transfer a copy of SpeedScript to the disk and rename it SPSCRIPT.OBJ. Copy SKCREATE and SKEDIT to the disk. Run SKCREATE and answer AUTORUN.SYS when asked for a filename. Run SKEDIT and define any keys you like. Be sure to save your keys with the filename DEFAULT.SOF. Turn the computer off and back on. Softkey will load into memory. Type DOS to go to the DOS menu. Select L, press RETURN, and type SPSCRIPT.OBJ. SpeedScript will start, and your key definitions will be ready.

About Softkey

The machine language Softkey program intercepts the keyboard interrupt and compares each keystroke to the defined macros. If the keystroke is not a macro, the key is passed on to the regular keyboard routines. If the key is a macro, each key of the macro is sent on to the built-in routines, one at a time. A keyboard buffer is built-in, allowing you to type ahead while Softkey is in control.

Softkey moves MEMLO up by 128 bytes and installs its own keyboard buffering and vertical blank routines. Most of the machine language routine and the 3K macro buffer are located in normally unused sections of memory. Softkey should be compatible with any program that uses standard keyboard calls, does not use the same memory locations as Softkey, and recognizes the new MEMLO setting.

For instructions on entering these programs, please refer to "COMPUTE!'s Guide to Typing In Programs" elsewhere In this issue.