Classic Computer Magazine Archive ST-Log ISSUE 28 / FEBRUARY 1989 / PAGE 66

Desk Switch

by Charles F. Johnson

ANY RESOLUTION

If you're anything like me, you probably like to have your ST desktop set up different ways for different functions—especially if you have a hard disk. You probably often change the positions of your windows and icons and the "safety" prompts used when you copy and delete files. (Even if you're nothing like me and don't have a hard disk, you may still do this!) For example, I like to have one desktop setup for word processing, one for copying files, one for MIDI work, one for graphics, etc.

You can save the current state of your desktop at any time, including all open windows, folders and installed applications, by using the "Save Desktop" function from the "Options" drop-down menu. When you do this, the desktop writes a file to your boot disk (A: for floppy users, C: for hard-disk users) called DESKTOP.INF. Unfortunately, TOS only reads this desktop configuration file once, when your computer is booted. If you want to change your desktop setup or the applications you've installed via the Options menu, you have two choices: reboot your ST (either by pressing the system reset button or by cycling power) or manually resize and reposition the windows with the mouse. This is where Desk Switch conies in.

Desk Switch lets you load a new desktop setup from disk and install it as the default. It will display a file selector to let you choose any file with an extension of .INF that will be loaded and installed as if you had just booted your system. (Desk Switch does some checking, but it's up to you to make sure that it really is a valid .INF file, written to disk with the Save Desktop function in the Options menu.) Desk Switch can also be installed as an application, so that simply double-clicking on any file with an extension of .INF will install it as the new desktop configuration.

Using Desk Switch

Break out your dusty old copy of ST BASIC and type in Listing 1. Be sure to check your typing carefully with STCheck before running it. This ST BASIC program will create an executable version of DESKSWIT.PRG on Drive A. To change the drive or filename, just change filename$ in the first line of the program.

Prepare to use Desk Switch by saving several desktop arrangements from the Options menu and renaming them to more descriptive names. For example, a desktop that has four windows open (the maximum) might be renamed from DESKTOP.INF to WINDOW4.INF. However you rename the DESKTOP.INF file, make sure to retain the .INF extension.

Once you have several desktop information files saved, there are two ways to use Desk Switch. The simplest way is to double-click on the DESKSWIT.PRG file from the desktop. When you do this you'll see the good old GEM file selector, waiting for you to select a DESKTOP.INF file to load. Just click on the filename and click the OK button (or double-click the filename), and that's all there is to it. You'll exit Desk Switch, and the new desktop arrangement will take effect immediately.

The other way to use Desk Switch is to install it as an application. Single-click on the DESKSWIT.PRG file to select it (make it inverse). Then go to the Options dropdown menu and select "Install Application." When you do this, a dialog box will appear with an editable line marked "Document Type" On this line, type in the three letters INF. Then click on the OK button with the mouse (don't press Return; that will select the Cancel button). To make this installation permanent, save your desktop. Now, whenever you double-click on a file with an extension of .INF, Desk Switch will load and install that file as the new desktop configuration.

In addition to window positions and installed applications, Desk Switch sets all the other parameters that the Atari Control Panel does, including the RS-232 (modem port) configuration, printer port configuration, screen colors, mouse double-click sensitivity, key click and bell tone on/off and key repeat/delay values, as they are stored in the .INF file you choose. If your ST contains a Blitter chip, Desk Switch will also turn the Blitter on or off depending on the stored parameters in the file.

Technical stuff: AES mystery functions

To install a new desktop definition, Desk Switch uses the shel__put AES call; this call and its opposite, shel__get, are rather mysterious. They are not even mentioned in the Atari Developer's Kit, and although you can find them listed in the Concise Atari ST 68000 Programmer's Reference Guide, there is no description of what the calls actually do.

Riddles like this are more fun than an Infocom adventure game for me (And the ST's operating system obliges me by providing plenty of them!) To unravel the mystery of shel__get and shel__put, I tried writing a simple program that did nothing but set up a small buffer and pass the address of the buffer to the shel__get call. After the call, when I examined my buffer to see what had been "shel__gotten," I was surprised to see what looked like the beginning of my DESKTOP.INF file!

As it turns out, shel__get and shel__put are used to read and change the current desktop configuration, respectively. The Atari Control Panel desk accessory uses these calls when you alter the color palette, or change key-repeat or mouse-response speed. Note that shel__get and shel__put only affect the image of the DESKTOP.INF file in RAM, not the actual DESKTOP.INF file on the disk. Current settings are saved to disk with the Save Desktop option.

Desk Switch reads in a DESKTOP.INF file by one of the two methods described above, then uses shel__put to write the new data into the system's desktop configuration buffer. Then it sets the rest of the parameters (colors, RS-232 settings, etc.) contained in the file. The new desktop setup will take effect as soon as the program is exited, when GEM reads its configuration buffer again to set up the desktop.

Desk Switch weighs in at just about IK, very small for a useful ST program. It was written entirely in 68000 assembly language, using the Mad Mac assembler from Atari Corp.