TransWikia.com

Did OSes write the floppy's logical sector number resulting from sector interleave/skew in the IDAM sector ID, or was it up to the OS?

Retrocomputing Asked on November 24, 2021

I’ve been looking at MicroBee floppy disk image files. They use the DSK/EDSK image file format originally created for Amstrad CPC emulators, probably because both systems use derivatives of the CP/M 2.2 disk layout.

This is a high-level image format which records information about each track and sector (but not down to the FM/MFM bits). The per-sector info includes track number, side number, sector ID, and sector size – the same info that FDCs have in the IDAM field before each actual sector data field.

My expectation was that the sector ID in the IDAM would contain the logical sector number that results from any sector skew/interleave. So for a disk with 10 sectors per track and a skew of 3 if I read the sector ID from each sector in order from one track I would expect one of these sequences of sector IDs:

0 3 6 9 2 5 8 1 4 7 or 1 4 7 10 3 6 9 2 5 8

Instead what I find is:

0 1 2 3 4 5 6 7 8 9 or 1 2 3 4 5 6 7 8 9 10

(For some MicroBee disk formats the sector IDs start at a much higher number, but the sequencing remains the same.)

And then I’m finding that the sectors containing the disk’s directory information is not contiguous, either by the order they come on the track, or by the sector IDs of the directory sectors.

For instance, some MicroBee disk images have the directory on sectors 1, 4, and 7 of track 1 going by the physical order on the track, which is sectors 2, 5, and 8 when going by their sector IDs.

So I was expecting the order of the sectors would be the physical sector numbering and the sector IDs in the IDAMs would be the logical sector numbering, and that the logical sector numbering would be the number after applying the skew/interleave factor.

But what I’m finding is that the sector ID in the IDAM only tells me whether sector number starts at 0 or 1, and does not tell me anything about the skew or interleave.

Does this mean that I had it wrong and that skew/interleave is never stored in the IDAMs? Or does it mean that some OSes might store it in the IDAMs and other OSes don’t?

Other possibilities are that it’s a quirk of the DSK image format, or a quirk of CP/M 2.2 or a quirk of the MicroBee. It’s hard to compare between systems or image formats because some are always in physical order and some are always in logical order. This info on the MicroBee disk format doesn’t answer my question and I can’t find any other info.

One Answer

I don't know the MicroBee, but grew up with CP/M 2.2 and 3.0 and its variety of floppy disk formats.

There were two different ways of implementing skew in use:

  • assigning the low-level sector IDs in a non-contiguous order, and simply access sectors by a 1:1 mapping from their logical number, resulting in sector ID sequences like 0 3 6 9 2 5 8 1 4 7,
  • assigning contiguous sector IDs like 0 1 2 3 4 5 6 7 8 9, and having the software (BIOS) translate from the logical sector number to the low-level sector ID.

The first approach meant you only had to consider skew in the formatting routine, while the second needed to do some sector ID translations in each and every disk access.

By the way, there were a lot more parameters to consider when trying to read a CP/M disk from a foreign system, e.g.

  • recording format FM or MFM,
  • physical sector size (popular from 128 to 512 bytes),
  • number of tracks/heads (40 or 80, single oder double sided),
  • track order with double-sided disks (sides interlaced or second side after first one),
  • allocation block size (typically 1 or 2 kBytes)

Answered by Ralf Kleberhoff on November 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP