This item is from the Yet Another Enhanced IDE/Fast-ATA/ATA-2 FAQ, by John Wehman and Peter den Haan with numerous contributions by others. (v1.92).
You asked for it :-)
If a drive is less than 504MB, it should have a logical geometry, as reported in Identify Device words 53-58, of 1024 or less cylinders, 16 or less heads and 63 or less sectors. Such a drive can be addressed directly without invoking this algorithm. For drives over 504MB, the CHS address received by the BIOS from DOS must be converted to an Extended CHS address, or an LBA address. We'll assume ECHS for now. First, during BIOS setup, the BIOS must determine the value of N. This value is used to convert the drive's geometry to a geometry that the BIOS can support at the int13 interface. This interface requires that Cyl be less than or equal to 1024. The number of cylinders (Identify Device word 1) is divided by N while the number of heads (Identify Device word 3) is multiplied by N. N must be 2, 4, 8,..., a power of 2.
Second, in most translating BIOSes, the following algorithm is used whenever INT 13H is called to perform a read or write:
eCyl = ( Cyl * N) + ( Head / dHead ); /* head DIV dHead */ eHead = ( Head % dHead ); /* head MOD dHead */ eSector = Sector; /* used as is */
By way of example, assume the drive's geometry is 2000 cylinders, 16 heads and 63 sectors (these numbers are in Identify Words 1, 3, and 6) and that the BIOS determines the value of N to be 2. The BIOS reports to DOS that the drive has 1000 cylinders, 32 heads and 63 sectors when int13 ah=08h function is called. This is 2016000 sectors.
Cyl/Head/Sector eCyl/eHead/eSector LBA
0/0/1 0/0/1 0 : : : 500/0/1 1000/0/1 1008000 500/15/63 1000/15/63 1009007 500/16/1 1001/0/1 1009008 500/31/63 1001/15/63 1010015 501/0/1 1002/0/1 1010016 : : : 999/31/63 1999/15/63 2015999
Note the following about this algorithm: The physical ordering of sectors on the drive is unaffected---sector n is followed by sector n+1 for all CHS and Extended CHS and LBA addresses. This is the only sane way of implementing translation, but unfortunately NOT ALL BIOSES DO IT THIS WAY. This means that changing translation modes may be a dangerous thing to do.