Jo22 wrote on 2021-12-10, 21:43:
This limit (504MiB) is (as you describe in the bottom of your post) the result of the combination of the BIOS limits and the IDE limits. There is no single specification limiting both cylinders to 1023, heads to 15 and sectors to 63 at the same time. But if you pass sector, cylinder and hard numbers from the BIOS interface 1:1 to the IDE interface, the you are limited to 1024 cylinders and 63 sectors due toe the BIOS interface, and to 16 heads due to the IDE interface.
Jo22 wrote on 2021-12-10, 21:43:
Actual interpretation for input depends on BIOS/Setup Utility, afaik.
Some may oddly expect human values entered as written on the HDD label ("16" for 16 heads total vs "15"), but use the technical values internally ("15").
I've yet to see a BIOS that requires you to enter the "maximum head number" (15 in your example) instead of the head count (16 in your example), but I wouldn't be surprised if a setup utility like that exists.
To circumvent the 504MiB limit, there are two approaches, both requiring some kind of translation of the parameters given to the BIOS to different values given to the hard drive. Modern IDE BIOSes allow three kinds of handling the BIOS parameters:
- NORMAL: No translation. Just pass the parameters as-is. You are still limited to 504MB
- LARGE: Shift some bits from the head number (the BIOS allows for 255 heads) to the cylinder number. For drives between 500MB and 1GB, one bit is shifted (you get 32 heads (still at 1024 cylinders) on the BIOS interface, and up to 2048 cylinders (still at 16 heads) on the IDE interface); For drives between 1GB and 2GB, two bits are shifted (you get 64 heads (still at 1024 cylinders) on the BIOS interface and 4096 cylinders (still at 16 heads) on the IDE interface). For drives between 2GB and 4GB (if supported by the BIOS), three bits are shifted (you get 128 heads on the BIOS interface, and 8192 cylinders on the IDE interface). The classic LARGE mode shifts whole bits, so the next level would be translating 256 heads to 16 heads by shifting 4 bits, and as already discussed, we can't use 256 heads because a lot of software assumes that the head count fits into 8 bits, so LARGE essentially limits you to 4GB.
- LBA: The bios does not communicate to the IDE drive using cylinders, heads and sectors at all. Instead, new IDE commands are used where the registers that were traditionally used to specify sector number (8 bits), cylinder number (16 bits) and head number (4 bits) are combined to a single 28-bit register and is interpreted as the number of sector on the drive, starting at 0, and then just counting no matter where track and head switches occur. This plain sector number is called "logical block address", and this also is how SCSI hard drives were addressed on the SCSI protocol level since SCSI 1. The BIOS calculates the logical block address from the parameters given to it (using the "fake geometry" it told the operating system), and then passes the block address to the hard drive. This mode is only works on hard drives supporting the new READ LBA and WRITE LBA commands. As this mode completely does away with the traditional IDE limits, it is only limited by the BIOS interface (8GB).
To circumevent the 8GB limit, you need a much more invasive change. The three modes discussed above work with DOS without DOS noticing, because the BIOS interface stays the same. But the BIOS interface is maxed out at 8GB, so a new interface had to be specified. The new interface that caught on is the Phoenix Enhanced Disk Drive specification, which is supported by Windows 95 in later OEM service releases and all versions Windows 98. This interface does away with C/H/S values on the interface between BIOS and DOS, and instead hands a 64-bit LBA value to the BIOS. As far as I know, this interface only works with hard drives supporting the LBA command set (which is mostly every IDE drive above 400 megabytes). Windows 9x only use the enhanced LBA calls to access data in partitions with "LBA-enabled" partition types. The partition type is only about how Windows talks to the hard drive, and even for non-LBA partitions, the BIOS might talk to the drive using logical block numbers, if the setup is set to "LBA".
Jo22 wrote on 2021-12-10, 21:43:
"Track 0" on HDDs/Floppies is a special case, also.
It contains boot code and isn't normally visible.
DOS utilities like S0kill can clear it, though.
No. For floppies, this is generally untrue. The first sector indeed contains the boot code, but already the second sector on the first track (cylinder 0, head 0) contains the first FAT sector on all classic DOS floppy formats. Yet, "Track 0" is special in the way that DOS format refuses to format a floppy if track 0 is bad. This is due to the fact that the boot sector, the FAT and the root directory are not relocatable on FAT12 floppies, so if one of the sectors that is supposed to contain these data structures is bad, DOS can't cope with the medium.
On hard drives, the situation is slightly different. Hard drives are partitioned. DOS does not access the hard drive as whole, but instead it accesses all (supported) partitions. Any space on the hard drive that is not part of a partition is not reachable using DOS interfaces - you need to resort to BIOS interfaces to access sectors that are not part of a partition. Partitions always start on "sector 1" on a track (by convention). The first sector of the hard drive contains the partition table, and describes where the partitions on the hard drive are located. The partition table can't be part of any partition itself. That's why cylinder 0, head 0, sector 1 (the first sector, LBA 0) can't be part of any partition. And as a partition needs to start at sector 1 of any track, the first partition can't start before cylinder 0, head 1, sector 1. The other sectors on cylinder 0, head 0 are indeed "invisible" to DOS.
Jo22 wrote on 2021-12-10, 21:43:
"Cylinders" is Fixed Disk (HDD) terminology.
"Tracks" is floppy disk terminology.
Software-wise, both refer to the same thing often, however.
Indeed. Often the terms are used interchangably. There is a clear definition that distinguishes these terms, though. This definition is unrelated to the medium being a floppy disk or a hard disk, though. A medium with more than one side (accessed using more than one head), is called to have a "track" on each side. Cylinder 0, head 0 is a different "track" than Cylinder 0, head 1. All of these "tracks" make up one "cylinder". The number of heads thus is the number of tracks per cylinder. A double-sided HD floppy thus has 160 "tracks". A track is identified by the cylinder number and the head number. The first track is the track at cylinder 0 you can accessed using head 0 (i.e. on the first side), whereas the last track is the track at cylinder 79 accessed using the last head (on floppies: head 1, second side). If you only consider a single surface / side, you only see a single track from each cylinder. So if you look at side 0 of this HD formatted floppy, you look at 80 tracks. If you look at side 1, you also look at 80 tracks. So you have two side of 80 tracks each. It thus also makes to talk about "track 79 on side 1" to mean the last track of the floppy, even if it is the 160th track. In short: If you talk about addressing, convetion is that you always explicitly specify the head, and count the tracks acessible through that head. So actually you are specifying cylinder numbers, even if you call it track numbers. Usually, you specify the number of tracks to specify what addresses are valid, so that's why you also say a floppy has "80 tracks", as the addresses range from cylinder number 0 to cylinder number 79. The one point where the track / cylinder distinction is important is when you talk about "sectors per track" versus "sectors per cylinder". A 3,5" HD floppy disk has 18 sectors per track. That is 18 sectors on head 0 and 18 sectors on head 1 of each cylinder, so 36 sectors per cylinder.