BPB

BPB STRUC

bpbBytesPerSec dw ? ;bytes per sector

bpbSecPerClust db ? ;sectors per cluster

bpbResSectors dw ? ;number of reserved sectors

bpbFATs db ? ;number of file allocation tables

bpbRootDirEnts dw ? ;number of root-directory entries

bpbSectors dw ? ;total number of sectors

bpbMedia db ? ;media descriptor

bpbFATsecs dw ? ;number of sectors per FAT

bpbSecPerTrack dw ? ;sectors per track

bpbHeads dw ? ;number of heads

bpbHiddenSecs dd ? ;number of hidden sectors

bpbHugeSectors dd ? ;number of sectors if bpbSectors = 0

BPB ENDS

The BPB structure contains information that defines the format of a disk or other storage medium.

Fields

bpbBytesPerSec

Specifies the number of bytes per sector.

bpbSecPerClust

Specifies the number of sectors per cluster. The sectors must be consecutive and a power of 2.

bpbResSectors

Specifies the number of reserved sectors on the drive, beginning with sector 0. Typically, this value is 1 (for the startup sector), unless the disk-drive manufacturer's software reserves additional sectors.

bpbFATs

Specifies the number of file allocation tables (FATs) following the reserved sectors. Most versions of MS-DOS maintain one or more additional copies of the FAT and use the extra copies to recover data on the disk if the first FAT is corrupted.

bpbRootDirEnts

Specifies the maximum number of entries in the root directory.

bpbSectors

Specifies the total number of sectors on the drive. If the size of the drive is greater than 32 MB, this field is zero and the number of sectors is specified by the bpbHugeSectors field.

bpbMedia

Specifies the media descriptor, a value in the range 00h through 0FFh that identifies the type of medium or disk in a drive. Some device drivers use the media descriptor to determine quickly whether the removable medium in a drive has changed. MS-DOS passes the media descriptor to the device driver so that programs can check the type of medium. Also, the first byte in the FAT is often (but not always) identical to the media descriptor.

Following are the most commonly used media descriptors and their corresponding media:

Value Type of medium

0F0h 3.5-inch, 2 sides, 18 sectors/track (1.44 MB); 3.5-inch, 2 sides, 36 sectors/track (2.88 MB); 5.25-inch, 2 sides, 15 sectors/track (1.2 MB). This value is also used to describe other media types.
0F8h Hard disk, any capacity.
0F9h 3.5-inch, 2 sides, 9 sectors/track, 80 tracks/side (720K); 5.25-inch, 2 sides, 15 sectors/track, 40 tracks/side (1.2 MB).
0FAh 5.25-inch, 1 side, 8 sectors/track, (320K).
0FBh 3.5-inch, 2 sides, 8 sectors/track (640K).
0FCh 5.25-inch, 1 side, 9 sectors/track, 40 tracks/side (180K).
0FDh 5.25-inch, 2 sides, 9 sectors/track, 40 tracks/side (360K). This value is also used for 8-inch disks.
0FEh 5.25-inch, 1 side, 8 sectors/track, 40 tracks/side (160K). This value is also used for 8-inch disks.
0FFh 5.25-inch, 2 sides, 8 sectors/track, 40 tracks/side (320K).

bpbFATsecs

Specifies the number of sectors occupied by each FAT.

bpbSecPerTrack

Specifies the number of sectors per track.

bpbHeads

Specifies the number of read/write heads on the drive.

bpbHiddenSecs

Specifies the number of hidden sectors on the drive.

bpbHugeSectors

Specifies the number of sectors if the bpbSectors field is zero. This value supports drives larger than 32 MB.