When accessing data on a disk via the IBM-PC's floppy disk controller, the driver must describe the location of that data in terms of its CHS coordinates. These coordinates are specified using three dimensions: cylinder number, head number and sector number.
A cylinder is an imaginary circle running around the disk. Each disk has a fixed number of cylinders running from the inner edge of the disk and the outer edge of the disk. A head is a device which actually reads the data from the disk. The modern IBM-PC's floppy disk has a head on each side of the disk for a total of two. These heads are also numbered. A track is a strip of data running around the disk on a specific side. That is, each cylinder and head combination addresses a specific track. The word sector has two meanings. In terms of a CHS coordinate, a sector is a division of a track. Multiple sectors run around the disk in a circular pattern.
The number of cylinders, heads and sectors that a disk has depends on the type of disk. Most modern 1.44MB floppy disks have 80 cylinders (numbered 0 to 79), 2 heads (numbered 0 to 1) and 18 sectors per track (numbered 1 to 18). Each CHS coordinate points to a specific block on the disk. Each of these blocks contains a certain number of bytes. Most modern disks use 512-byte blocks.
(NOTE: A block is more commonly called a sector. This is not to be confused with the "sector" dimension described above which is a division of a track. For the purpose of this article, a "disk-wide sector" will be referred to as a "block".)
The addressing method used by almost all modern filesystems is called linear base addressing (LBA). In linear base addressing, only one number is used to address data, rather than three. Each linear base address describes a single block. The reason for using LBA instead of CHS in the filesystem is because of its simplicity. Most modern floppy disks contain 2,880 blocks (numbered 1 to 2,880).
LBA = ( ( CYL * HPC + HEAD ) * SPT ) + SECT - 1
Where:
LBA: linear base address of the block CYL: value of the cylinder CHS coordinate HPC: number of heads per cylinder for the disk HEAD: value of the head CHS coordinate SPT: number of sectors per track for the disk SECT: value of the sector CHS coordinate
This equation is not used very often. Ussually the software already has the LBA value and needs to calculate the CHS value for it.
CYL = LBA / (HPC * SPT) TEMP = LBA % (HPC * SPT) HEAD = TEMP / SPT SECT = TEMP % SPT + 1
Where:
LBA: linear base address of the block CYL: value of the cylinder CHS coordinate HPC: number of heads per cylinder for the disk HEAD: value of the head CHS coordinate SPT: number of sectors per track for the disk SECT: value of the sector CHS coordinate TEMP: buffer to hold a temporary value
This equation is used very often by operating systems such as DOS to calculate the CHS values it needs to send to the disk controller or INT13h in order to read or write data.
Search Encyclopedia
|
Featured Article
|