ON DISK!
Small Tools
Autobooting Your Hard Disk
BY DAVID SMALL WITH DAN MOORE
Add another tool to your toolbox with REVIVE.ARC on your START disk.
Over the last months, we've been looking into the seemingly vague science of floppy and hard disks: the lore, the myth and the mystery. Let's continue with a discussion of autobooting hard disks.
In the best tradition of "tell them what you're going to tell them," this column and the next column on hardware should give you an in-depth understanding of hard disks. The column after that will begin our "troubleshooting" series. You know now about CRC errors, sectors, partitions, RWABS and how the hard disk hooks in, plus you have some tools to help debug your floppies and hard disks in a variety of situations. (If you've missed part of the series, let me recommend getting the back issues of START beginning with the December 1988 issue.)
Now, onwards and forwards....
Autobooting Hard Disks
Not long after the first ST hard drive hit the market, Atari and the after-market people found out how to make the hard disk start up automatically, without floppies. It was more than a little tricky.
I'm going to go into this, not because I enjoy confusing you, but because this is the process that often fails and prevents you from starting up your hard disk. It happened to me at COMDEX a little while ago, for instance--and only the tools I'd brought along let me diagnose the problem.
Remember back to the RWABS column (START February 1989)? I explained there how the ST "wakes up" with only the floppy disk handlers for drives A and B. Now, you say, how can the Atari start up the hard disk if it can't talk to it without reading a hard disk handler from the floppy drive? No floppy + no handler = no hard disk.
Well. . . the ST does have a primitive, baby hard disk handler built into its ROMs with the ability to read in only the partition sector. It's not a full RWABS handler, just barely enough to read in one sector.
On power-up, an intricate dance takes place between the ST and its drives. Let's take a look:
1. As the ST wakes up, it polls the A floppy drive and tries to read in its sector 0.
If the floppy disk in drive A has an "executable sector 0" (which means that this sector is flagged in a special way), then the ST goes ahead and executes it immediately. NOTE: This virtually never happens these days. But if you're a longtime ST owner, you've seen it; your old TOS-in-RAM boot disk did this! Way back in 1985, no one had TOS in ROM; the system came shipped with two baby ROMs which could only read in sector 0 of floppy drive A on startup. The program in sector 0 would tell the system to load TOS, the entire operating system from the floppy disk.
These days, by the way, TOS 1.4 is being beta-tested via an autoboot floppy disk, so we're back to where the ST started from! The rest of the "startup process" described below doesn't apply on an autoboot from a floppy, but again, this is rare. (Note: This is where a "virus" usually locks onto a floppy.)
Most floppies these days do not have an "executable sector 0"; I'd say about 99 percent. The exceptions are some games, TOS in RAM and the Hard Disk Reviver program's floppy disks (more on this later).
Let's assume that either we could not read in sector 0 of the drive A floppy, (usually because there's no disk in the drive), or we read it in and it wasn't marked "executable" (like 99 percent of all floppy disks). The start-up process then will continue.
2. The system then tries to read in the partition sector of the hard disk.
The ST handles this the same way it handled the floppy disk; if the sector is marked executable, it executes the instructions within. Yes, that means that there's a program in the partition sector, which can also contain partition information for up to 12 partitions--pretty crowded for one sector isn't it? There's just 512 bytes in there.
If the partition sector can't be read (the hard disk's not ready yet, not hooked up, broken, turned off, etc.), then the system proceeds to the next step.
If the partition sector can be read in, but isn't marked executable, the system shrugs, says "Oh well," and goes on to step three, where an "ordinary" boot continues.
If the partition sector can be read in and is marked executable, strange and wonderful things happen. Let's say that you have a particularly clever hard disk partition sector with exactly the right program in it. This program would self-install a hard disk driver (into the RWABS hook) at this stage in the system boot, and then tell the ST to look at drive C for things like the Desktop Information. The start-up proceeds from there.
Most likely, the next thing that will happen is for the hard disk driver to look at the partition sector, figure out which drive letters it wants to handle, and settle into the system. And now you've done it--you've managed to boot from the hard disk without the floppy attached!
All of the things that I've mentioned can go wrong--will go wrong--at some point. If the system won't boot up from the hard disk, one of these many points has gone wrong; you'll have to trace through and find out which one it is. However, you now have a list of things to check--knowledge is power.
3. If neither sector 0 is executable, then the system really shrugs, figures it's that sort of day and starts up the Desktop with the icons found in drive A's DESKTOP.INF file.
If there's no such file/disk--which happens a lot--it'll say "Oh Well," and plot the A and B drive icons as a default. (Note: This is where you'll usually end up with a hard disk boot problem; you don't get a C: icon. Even if you install one by hand, it's not hooked up through RWABS to work.)
Timeout
It takes a long time for the system to get through step number one if there's no floppy in the drive--the system has to "time out," and that takes a while. Thus, if you turn on your ST with no floppy in the drive, it takes a long time for the system to reach step two and try to boot the hard disk. This is why autobooting sometimes seems to take forever.
The solution? Just keep a normal, formatted, empty floppy disk in drive A. Make it a formatted floppy please; blank floppies must also time out, which also takes a while. What you need is for the system to read in sector 0 from the floppy as quickly as it can, look at it, conclude that it's not executable and move on to step two, start-up from the hard disk. (Note: This delay has been considerably shortened in the Mega and TOS 1.4 ROMs, so you Mega owners can probably skip formatting, if you like.)
Manual Start
If the hard disk is not spun up, reset, and ready to go on power-up, you're going to fail on step two. I mentioned this already; it's the Dread Power Strip Problem discussed in this column in the February 1989 issue of START. The system then won't know the hard disk is there unless the system is reset.
Note, however, that if you run the hard disk driver program by hand (by double-clicking on the driver; it might be called AHDI.PRG, or SUPBOOT.PRG or whatever), you can "wedge" the hard disk driver in after the system has started up. It will then install itself into the RWABS hook, read the hard disk's partition sector to see what requests it ought to handle, and so on.
This is one very useful technique to remember when the "autoboot" fails; very often you can run the hard disk driver by hand and then access the hard disk. Also, very often, if you can't get to the hard disk at all to find the hard disk driver, you can run this program from a floppy disk and the hard disk will "wake up." Oddly enough, sometimes that fixes the problem.
Some hard disks need to "clear their throats" before they can autoboot. My Hewlett-Packard drives, for instance, always fail on the first hard disk read after power-up--they're designed that way. (I have no idea why.)
Of course, if you do this from the Desktop, you'll probably have no disk icons for the hard disk, so you'll have to go to the trouble of installing them. (Or you can use a command-line interface shell program and not bother with the Desktop at all.)
Re-Run
You can re-run the hard disk driver program many times. There is no danger in this. All that will happen is that you'll use up a little more memory (where the program and tables are stored) each time and you'll keep trying to read in the hard disk partition sector. This can be handy when debugging a flaky hard disk, because you're definitely doing something that should cause the hard disk light to flash, as sector 0 is read. If the light doesn't flash, it's a hardware problem. (Even better is to use Supra's utilities, but if you don't have them....)
The Mark
A floppy or hard disk sector is marked "executable" by having its contents add up to $1234. (You adjust the last two bytes to make the sector come out to $1234). Thus, if you do anything that modifies the hard disk partition sector, it will not come out to $1234 anymore unless you make the effort to fix it. It won't autoboot any longer and you'll end up with two floppy icons on the screen--making you think you've lost your drive.
Note: Any time you change a partition to another type, as with Magic Sac, Spectre 128, and possibly pc-ditto, this happens.
The solution? Just re-install the autoboot, using whatever program you originally set it up with; all fixed!
Multiple Autoboots
If you have multiple hard disks out there (as many people are starting to do; see also "Megabytes, Not Mega bucks," START, Winter 1987, on how to install a second hard disk into your present drive), then the system will boot all of them that have "bootable" partition sectors. If you see the "xxxx Drive AutoBoot. . " message several times during boot, you'd best go turn off the other drive's autoboot process, using its autoboot utility. If not, you've got several drivers, possibly of different brands or revisions, using up memory and possibly even fighting with one another.
Multiple Drives
The Atari will attempt to start up from LUN 0 (Logical Unit 0) of SCSI devices 0-7 during boot. It tries to boot all eight devices at start-up. Hence, any time you press the reset button, you should see every LUN 0 on the system flash its light briefly as it is polled. When you have five drives hooked up (as I do), there's a neat rippling effect across them. Anyway, if your drive doesn't flash after a reset, there's hardware trouble.
Kludged Partition Sectors
You can get into a nasty "no win" situation if the self-boot process becomes corrupted. Let's say the partition sector's program becomes fouled up somehow. (Damage to AHDI.SYS or SUPBOOT in the AUTO folder, for instance--say, if a hard disk write goes awry.)
On power-up, the floppy will read in briefly, the hard disk will read in, try to boot and the system will crash while running the partition sector program. Typically, you'll get two or three bombs onscreen, but it can vary-- once I saw 23! To fix this, re-install the Autoboot driver from floppy. But you can't even turn the system on, can you? Hmmmm-MMMmmm.
If you turn off the hard disk, you can at least boot. Well, great. But turning on the hard disk when the computer is already on will crash the computer. (This doesn't happen with all drives: it depends on the model of hard disk you have. The early Atari interfaces, for instance, did this a lot.)
Believe it or not, there's a solution to this logjam: the aforementioned Reviver program originally published in the Spring 1987 issue of START. Because of its usefulness, we're republishing Reviver in this issue's START disk. All it does is make you an "executable" floppy disk that does nothing except bypass the hard disk boot. You run Reviver, put in a floppy, and that floppy becomes executable. In other words, Reviver lets you power on the Atari with the hard disk powered on, but zaps the autoboot. (Reviver is a good example of a program written in desperation; my hard disk had gone bad in this way. It's the only solution I know of to this particular method of the hard disk going bad. Reviver is on this issue's START disk for you to add to your tool library.)
Then, you can start up your computer with the hard disk attached, the floppy overrides the hard disk self-boot and you can at least get to the Desktop and run the hard disk driver by hand. Then you can try re-installing the autobooter to fix it. Reviver is a good thing to have; it's on my "must take" list of utilities for computer shows, etc.
You may be able to switch on your hard disk after your computer is turned on and booted without it crashing. Go ahead and try it. If you get away with it, install the hard disk driver (SUPBOOT, AHDI, etc.), and re-install the hard disk autobooter. That should cure things. (Note: The same thing applies to bad desk accessories or Auto-folder programs. You'll crash on start-up and the only way out of it is to boot without the hard disk, get it online somehow and remove the offending accessory.)
Warning: The upcoming TOS 1.4 ROMs are incompatible with many Auto-folder programs and probably many desk accessories. Beware when you switch!
Next issue we'll take a look at some hardware details that should provide you with a balanced (and fairly complete) picture of the entire ST/hard drive relationship.
START Contributing Editor David Small is the creator of the Magic Sac, Translator I and Spectre 128. Dan Moore is the author of Paper Clip for the 8-bit Atari and the never-released Paper Clip Elite for the ST.
PRODUCTS MENTIONED
Supra Hard Disk Utilities, $24.95. Supra Corp., 1133 Commercial Way, Albany, OR 97321, (503) 967-9075
START Back Issues, see the Back Issue advertisement in this issue for availability and price of back issues, or call {800) 234-7001.
|