Coder's Guild Mailing List

Calculating Amount of Disk Space from C/H/S

Posted by Kspansel@xxx.xxx on 1999-08-17

How would go about finding the amount of space (in bytes) on a floppy disk or 
hard disk, knowing the number of cylinders, heads and sectors.  I thought it 
was like this:

Disk Space = Cylinders * Heads * Sectors * 512

But that is giving me incorrect results..of my way of finding the c/h/s is 
incorrect.  I use bios function 13h sub-function 8h.  I may be 
mis-interpertting the info given.  
CH and bits 7 and 6 of cl give me the cylinders
cylinders = cx shl 6
the lower 6 bits of cl is the number of sectors per track this would be 
sectors per cylinder also, would it?  
sectors = cl and 3fh
And dh returns the number of sides (zero based), would this be the number of 
heads?  
heads??  = dh

Any help would be very much apprectiated..Thanks

Kory Spansel