Does anybody know the proper way to translate from CHS to LBA?
I was looking the code for the dos UDMA drivers(http://linux.tu-varna.acad.bg/~lig/freedos/) and the translation kind of confused me.
Basically he called int 13, ah=8 to get the drive parameters.
Anded the sectors with 3fh to make sure it was less than 64, which made sense since sectors usually max out at 63, and start with sector 1.
But for the heads, he increase a byte by 1 and then multiplies by the sectors to get the number of sectors per cylinder.
I thought the max number of heads would be 256(o-255) rather than 255 indicated by this algorithm. This would be due to the fact that if int 13,8 returned 255 for heads, it would increase this value to 0 and then the multiplication would fail. Hale Landis' site shows for CHS max heads should be 256 and max sectors should be 63.
My drive showed up with 254 heads returned from the int13,8 call, so no problem. Was wondering if anybody could clarify this for me.
Thanks in advance,
...Gomer73
|