19

If a formatted floppy diskette is reformatted with a low-level¹ format, how does the formatting routine make sure that any previous sector markers are fully overwritten? In particular, how does it make sure that the first sector marker from any previous format is overwritten?

(If a previous sector marker was not properly overwritten that could obviously confuse any routines later reading the floppy diskette.)


¹"Low-level" appears to be modern (late-80s/early-90s) terminology used to distinguish rewriting the sector markers on soft-sectored diskettes from merely rewriting the filesystem information.

26

Low-level formats of floppies do not do individual sector writes, as normally done when writing new data to a sector of an already-formatted floppy, but instead rewrite each entire track in one operation. This is done in such a way that the entire track, including unused areas, is overwritten, ensuring that there will be no data left from previous formats.

The data sheet for the Fujitsu MB8877A Floppy Disk Formatter/Controller (FDC) explains this fairly clearly. Page 8 contains the details of track formatting, including the gaps between sectors:

Track format diagram

Further down on the page are the exact details of byte values and counts; for our purposes all that's really important is that all of the gaps in an MFM ("double-density") format are a continuous stream of $4E values.

Page 10 gives the details of what data to feed to the FDC during a "write track" command in order to format a track:

Double-density MFM format with write-track command

What happens during this sequence is that you seek the head to the track you want to format, send a "write track" command, and write $4E to the data register (DR), indicating that you want the controller to write a post-index gap byte when it starts writing. This will clear the data request bit (DRQ) in the status register.

The controller will wait until it's detected the index mark (via the small hole near the centre of the diskette passing an optical sensor) and then start writing that byte. In the meantime you must be checking the DRQ bit; when it becomes set you must write another $4E to the DR, doing this 80 more times. This creates the post-index gap. You then carry on writing the other bytes described in the table above until you've written address markers, data fields and gaps for all of the sectors.

At this point there's still a gap of variable size to be written. (The size varies due to small variations in the speed of the motor.) To fill this out completely you continue to write $4E filler bytes as above until the controller sets its INTRQ line, which indicates that it's again seen the index hole and you are now writing again over the post-index gap you wrote at the start of the track format operation. This ensures that all data previously on the track have been overwritten. A little bit of "overflow" here does no harm because it's merely writing into the unused space of the post-index gap.

| improve this answer | |
  • "(The size varies because tracks get longer as you move outward from the centre of the diskette.)" -- no, at least until the bitrate is not constant. – lvd Mar 1 at 20:47
  • @lvd, The 3 1/2" floppies for the original Macintosh computer wrote more sectors in the outer tracks than in the inner tracks. They varied the rotation rate of the disk rather than varying the number of bits per second. siber-sonic.com/mac/newmillfloppy.html – Solomon Slow Mar 1 at 22:04
  • 2
    @SolomonSlow True, but lvd is correct for this example, which uses the more common constant bit rate. This was just a brain fart on my part; I've fixed the post. – cjs Mar 2 at 3:52
  • 5
    This answer is explaining perfectly that the whole length of the track gets rewritten. It does not talk about the width of the track. The canonical example where this goes wrong in practise is reformatting a 360K floppy (40 tracks) in a 1.2MB drive (80 tracks, double-stepped). The tracks written by the 80-track drive are narrower than tracks written by a 40-track drive, so the formatting of every other track in the 80-track drive might leave residues of the previous contents between the small new tracks. This residue can be picked up by a 40-track drive which reads wider tracks. – Michael Karcher Mar 2 at 6:46
  • 2
    @Michael Right: I was trying to answer a specific question here (brought up elsewhere, actually) about how this works within one particular format; compatibility between different drive types is a completely different question. And note that it's not just 1.2 MB HD drives that have this issue; 720 KB double-density drives have the same interchangability problem with 360 KB DSDD drives. – cjs Mar 2 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.