• No results found

Floppy Disk Low-Level Format

A slightly different low-level format is specified for the two encoding methods, but both of these formats require, for each track on the disk, astart of tracksequence of bytes, asector formatsequence which includes the CHS address and the data block for each of the sectors, and anend of tracksequence of bytes.

As mentioned earlier, bytes are recorded sequentially along the track, with each byte itself being recorded as eight serial bits. At Table 5.2 (Messmer, 2002, p. 791) we have shown the sequence of bytes that are required for a 5.25 inch floppy disk track in IBM format using the MFM (Modified Frequency Modulation) encoding method that we discussed in the previous section.

Referring to Table 5.2, we note that a track always starts with a so-called GAP 4A sequence, which consists of 80 bytes each of value 4eh. This is the hex value that is used for all gaps in this format. Although early floppy disk controllers could recognize the beginning of the track by means of the index hole on the floppy, as we mentioned above, the physical size of this hole is far too large and its physical position is far too imprecise to determine precisely where the track on more modern disks begins4. The 80 byte 4eh pattern warns the disk controller that the track is about to start and gives the electronics time to synchronize with the 12 byte sequence of 00h which follows. This is known as thesynchronization(SYNC) block.

The four bytes of theIndex Address Mark(IAM) tell the controller that the sectors of the track are about to follow, and immediately after this there is another gap of 50

● A data bit is always written if it is equal to 1.

● A clock bit is only written if the preceding bit cell as well as the current bit cell does not have a data bit set.

Table 5.1 Rules for MFM encoding.

4 Data bits on a 15 sector per track floppy are only about 2 microns apart, whereas the index hole is about 1 mm in diameter.

bytes of 4eh, GAP 1. It is this Index Address Mark that signals the true start of the track5.

After the start of track sequence, the sectors proper begin. Each of the sectors (and in this format there are 15 of them) has ten sections, of which only those for sector 1 are shown in the diagram. After another synchronization (SYNC) sequence of 12 bytes of 00h, theID Address Mark(IDAM), which we mentioned above, follows; this indicates the start of the ID or identification field for the sector concerned and is where the CHS address is held. The ID field is made up of four bytes, of which three are used forcylinder,headandsectoraddressing and the fourth is used to indicate thesector sizefor floppy disks and as aflagbyte for hard disks, the details of which we will look at later. At Fig. 5.4 we have shown the layout of the first three of the four ID bytes which provide the CHS address for the sector. Ten bits are used for the cylinder6 address with theleadingtwo bits of that address being taken from the high end of the sector byte (the third byte). This gives a maximum cylinder address of 1023, and since the cylinder count starts from 0, we may address up to 1024 cylinders. Eight bits are used for the head address (the whole of the second byte) giving a maximum value of 255, and since the head count starts from 0 we may address up to 256 heads. Only six bits are used for the sector address (the remainder of the third byte), giving a

GAP 4A 80 bytes 4eh Start of track

SYNC 12 bytes 00h

IAM 4 bytes c2h c2h c2h fch GAP 1 50 bytes 4eh

SYNC 12 bytes 00h Start of sector 1

IDAM 4 bytes a1h a1h a1h feh

ID 4 bytes cylinder head sector sector-size

1024 cylinders, 256 heads, 63 sectors

CRC 2 byte CRC value GAP 2 22 bytes 4eh SYNC 12 bytes 00h

DAM 4 bytes a1h a1h a1h fbh (or f8h) Data 512 bytes data

CRC 2 byte CRC value

GAP 3 80 bytes 4eh End of sector 1

... Sectors 2 to 15

GAP 4B ?? bytes 4eh End of track

Table 5.2 5.25 inch floppy disk format MFM encoding.

5 Floppy disks used to fail rather more frequently than today, and one error message would often be “Missing index address mark”.

6 Recall thatcylindernumbers are the same astracknumbers; they represent the position of the head assembly.

maximum value of 63, and, since the sector count conventionally always starts from 1, we may address up to 63 sectors.

Because of the importance of these ID marks, a two-byteCyclic Redundancy Check (CRC)7is calculated and stored at format time for the IDAM and ID fields. Another gap then follows of 22 bytes of 4eh, GAP 2, which is deliberately put there to give the controller time to check this CRC, and then there is another synchronization (SYNC) sequence of 12 bytes of 00h. This is followed by theData Address Mark(DAM), which signals the start of the actual 512 bytes of data8.

After this data block comes another two-byte CRC, calculated for the whole of the data area, and the sector is finally terminated by another gap, GAP 3, of 80 bytes of 4eh. This gap is designed to be long enough to allow for any variations in recording speed and thus avoid the inadvertent overwriting of the following sector. This first sector is then followed by the other 14 sectors, using exactly the same format, and then theEnd of Trackis written as GAP 4B, a variable number of 4eh bytes forming a flexible buffer which finally links up with GAP 4A. With all of this laid down during formatting, we can easily see why a formatted disk has less usable data space than an unformatted disk. We can also see how a disk controller can confirm that it has accessed the correct CHS address by checking the sector ID field.

The 8.4 Gbyte Barrier

Having discussed track and sector formatting now in some detail, it might be useful at this point to consider what implications, if any, these data structures could have on hard disk capacity. Although there is not going to be any problem for current floppy disks, with their very limited capacity, it is important to understand that we have, at the level of the disk format itself, imposed limits on the range of CHS addresses that are possible. This is because we have used fixed sizes for the numbers of bits that have

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

cylinders = 1024 (0 to 1023)

heads = 256 (0 to 255) sectors = 63 (1 to 63) Fig. 5.4 CHS of ID field.

7 A cyclic redundancy check is a form of checksum that can be used to detect certain kinds of error. For a good detailed explanation, see Messmer (2002, pp. 796–800). 8 Data sizes other than 512 bytes are possible for floppy disks and these would be

indicated appropriately by the setting in the fourth byte of the ID. However, 512 bytes is the size most usually adopted.

been allocated to each of the three CHS parameters, namely: 1024 cylinders (0 to 1023 in 10 bits), 256 heads (0 to 255 in 8 bits) and 63 sectors (1 to 63 in 6 bits).

The maximum number of sectors it is thus possible to address is 1024 × 256 × 63, and given that the normal sector data size is 512 bytes, we can calculate the theoretical maximum size of a formatted disk as 1024 × 256 × 63 × 512 bytes = 8,455,716,864 = 8.4 Gbyte9. Here is one of the factors that originally resulted in the so-called8.4 Gbyte barrier. This ID field structure is the structure of the original low- level format design for floppy disks which was carried over with little modification into the ST412/506 low-level format design when hard disks first became available. It is also precisely the same structure that is used for the INT 13h10 disk access mechanism where the three bytes of Fig. 5.4 equate to the three registers CH, DH and CL respectively. We will be looking at this in detail in a later section in order to under- stand many of the hard disk design concepts. Hard disk manufacturers have tended subsequently, in their low-level formatting design, to utilize these four ID bytes in rather different ways in order to help overcome this barrier, as we shall note later. However, since the low-level format structure is completely hidden from the outside world by the disk controller in modern hard disks, some manufacturers11 have radically revised the data structures which they use in their low-level formats. As a result, the four ID bytes are no longer a factor in the 8.4 Gbyte barrier.