The Editors and Readers of COMPUTE!
If you have any questions, comments, or suggestions you would like to see addressed in this column, write to "Readers' Feedback," COMPUTE!, P.O. Box 5406, Greensboro, NC 27403. Due to the volume of mail we receive, we regret that we cannot provide personal answers to technical questions.
1541 Disk Drive Rattle
I have seen a BASIC command that prevents the Commodore 1541 disk drive from knocking when protected software is loaded. Is there any way to prevent the knocking sound when you format a new disk? I am worried that too much knocking will force my drive out of alignment.Tom Smith
While it's true that head-knocking isn't particularly good for the drive, there's no easy way to prevent it during the format process. The 1541 drive is often called an "intelligent" peripheral because it contains its own microprocessor, free RAM, and operating system in ROM. The knocking sound heard when you format a disk is deliberate. It's caused by the format routine itself, which is permanently recorded in the drive's ROM.
A Commodore 1541 disk contains 35 tracks, numbered 1-35. Track 35 is nearest the center hub, and track 1 is the outermost. The drive always begins formatting with track 1 and proceeds inward, formatting one track at a time. To locate the read/write head accurately for the beginning of this process, the drive steps the head outward a total of 46 tracks. Since the drive is designed to access only 35 tracks in normal use, this maneuver is guaranteed to cause a read/write error regardless of the read/write head's initial position. The rattle is caused when the read/write head pounds against a mechanical metal stopper. The stopper physically prevents the head from moving past the outer edge of the disk.
As you've seen, the command that prevents the head from knocking in other cases doesn't work when formatting. That method works by storing a smaller than usual number in location $6A in the drive's RAM. This location is a zero-page counter used to control how many times the drive should try to access a requested sector before giving up and signaling a read/write error.
The reason this trick doesn't work is that the ROM formatting routine, the relevant portion of which begins at $FAC7 in ROM, pays no attention to what's in location $6A. After stepping the head out 46 tracks, the ROM routine does set up a counter (at location $0620), but that's used to keep track of the number of errors encountered after the head-knock takes place.
It is possible to format a disk without rattling the head, but the alternatives are fairly involved and may be less reliable than the usual method. The first catch is that you need the ability to write a machine language routine for the drive to execute, download that code into one of the drive's RAM buffers, then cause the drive's microprocessor to execute it in place of the ROM format routine.
For those who are up to that challenge, here's one possibility: If your drive is correctly aligned, then, rather than locating the read/write head in the usual way, why not use a commercially formatted disk for calibration? Mass-produced commercial disks such as the 1541 Test/Demo disk are usually created on industrial equipment, not 1541 disk drives, and software companies have a strong incentive to keep such equipment in good alignment. So any commercial disk that doesn't contain deliberately implanted errors should be very close to the standard.
The idea is to insert the calibration disk, move the drive's read/write head to track 1 by reading track 1, sector 0, leave the read/write head stationary at that point, perform the other setup tasks required, then enter the ROM format routine at a point that bypasses the head-knocking section. That's a fairly tall order for most programmers and requires a much longer program than we can include in this space. This scheme could also increase the risk of inconsistent results, since it relies on two critical assumptions—that your drive is correctly aligned and that the calibration disk was accurately formatted in the first place—which may not be true in every case.