Function 02H (2): Build BIOS Parameter Block (BPB)

The build BPB function applies only to block devices, and in character-device drivers should do nothing except set the done flag. The kernel uses this function to get a pointer to the valid BPB (see Figure 14-7) for the current disk and calls it when the disk-changed code is returned by the media-check routine or the don't-know code is returned and there are no dirty buffers (buffers with changed data that have not yet been written to disk). Thus, a call to this function indicates that the disk has been legally changed.

The build BPB function receives a pointer to a one-sector buffer in the request header. If bit 13 in the driver header's attribute word is zero, the buffer contains the first sector of the FAT (which includes the media identification byte) and should not be altered by the driver. If bit 13 is set, the driver can use the buffer as scratch space.

The build BPB function is called with

RH + 1 BYTE Unit code

RH + 2 BYTE Command code = 2

RH + 13 BYTE Media descriptor byte

RH + 14 DWORD Buffer address

It returns

RH + 3 WORD Status

RH + 18 DWORD Pointer to new BPB

Under MS-DOS versions 3.0 and later, if bit 11 of the header's device attribute word is set, this routine should also read the volume label off the disk and save it.