On 22 Dec 2006 at 10:46, Dave Dunfield wrote:
btw - with floppies, it can be worse...
Much worse. In fact, when talking about floppy addressing, one needs
to take into account the following:
a. The physical position of the sector/side/track on the disk.
b. The address in the header for each sector on the disk
c. What the driver calls them
d. What the operating system calls them
For example, if the OS/driver combination uses a transparent sparing
method, there is a translation between (c) and (d) that maps out bad
sectors, so the disk appears to be a continuous span of unflawed
sectors. Another example is the insistence of CP/M on 128 byte
sectors--there's a blocker/deblocker that maps 128 byte sectors to
256 byte or larger sectors.
For (b) to (c), the driver generally performs a translation from some
sort of linear consecutive addressing to whatever the floppy sector
addresses are. Usually, this is a form of sector "skewing" , but it
needn't be--I've got at least one OS sample that places sector 0 on
track 20 on a 40 track disk (SSDD, so tracks=cylinders in this case).
The sequence then proceeds from track 20 outward to track 0, then
inward from track 21 to track 39. Similarly, on double-sided
diskettes, addressing can proceed from sector, then side, then
cylinder or sector, cylinder then side. Some formats go from
physical cylinder 0 to cylinder n on one side, then from cylinder n
in reverse down to cylinder 0 on the other side. Others start at
cylinder 0 again. Some formats start on the bottom surface; others
on the top.
For (a) to (b), just about anything in the address fields will
generally work, unless a controller insists on a particular
convention. A skew may be built in, so that driver software doesn't
have to deal with it. Controllers that can do multisector will
benefit from sector addresses that are consecutive by 1, but there's
no inherent demand that it will be so.
All of which makes talking about cylinder, track and sector on
floppies extremely confusing. I try to disambiguate a bit by using
the term "physical" to refer to the absolute location of sides and
tracks, but use the header ID value to refer to sector numbering.
Thus, if the first sector on a track is addressed as 129, I'll talk
about sector 129, not sector 0.
Cheers,
Chuck