|
| |
BUILD BPB (BIOS Parameter Block)
command code = 2
ES:BX pointer to request header. Format:
length field
byte media descriptor from DOS
dword transfer address (buffer address)
dword pointer to BPB table
DOS calls BUILD BPB under the following two conditions:
A) If "media changed" is returned
B) If "not sure" is returned, there are no used buffers. Used
buffers are buffers with changed data that has not yet been
written to the disk.
The driver must do the following:
A) set the pointer to the BPB
B) set the status word in the request header.
The driver must determine the correct media type currently in the
unit to return the pointer to the BPB table. The way the buffer
is used (pointer passed by DOS) is determined by the non-IBM
format bit in the attribute field of the device header. If bit
13=0 (device is IBM compatible), the buffer contains the first
sector of the FAT (most importantly the FAT ID byte). The driver
must not alter this buffer in this case. If bit 13=1 the buffer
is a one sector scratch area which can be used for anything.
For drivers that support volume identification and disk change,
the call should cause a new volume identification to be read off
the disk. This call indicates that the disk has been legally
changed.
If the device is IBM compatible, it must be true that the first
sector of the first FAT is located at the same sector for all
possible media. This is because the FAT sector is read before the
media is actually determined.
The information relating to the BPB for a particular media is
kept in the boot sector for the media. In particular, the format
of the boot sector is:
+---------------------------------------------------------------+
| For DOS 2.x, 3 byte near jump (0E9h) For DOS 3.x, 2 byte near |
| jump (0EBh) followed by a NOP (90h) |
+----------+----------------------------------------------------+
| 8 bytes | OEM name and version |
+----------+-----+----------------------------------------------+
| BYTE | | sectors per allocation unit (must be a |
| | | power of 2) |
+----------+ +----------------------------------------------+
| WORD | B | reserved sectors (strarting at logical |
| | | sector 0) |
+----------+ +----------------------------------------------+
| BYTE | | number of FATs |
+----------+ +----------------------------------------------+
| WORD | P | max number of root directory entries |
+----------+ +----------------------------------------------+
| WORD | | number of sectors in logical image (total |
| | | number of sectors in media, including boot |
| | | sector, directories, etc.) |
+----------+ B +----------------------------------------------+
| BYTE | | media descriptor |
+----------+ +----------------------------------------------+
| WORD | | number of sectors occupied by a single FAT |
+----------+-----+----------------------------------------------+
| WORD | sectors per track |
+----------+----------------------------------------------------+
| WORD | number of heads |
+----------+----------------------------------------------------+
| WORD | number of hidden sectors |
+----------+----------------------------------------------------+
The three words at the end return information about the media.
The number of heads is useful for supporting different multihead
drives that have the same storage capacity but a different number
of surfaces. The number of hidden sectors is useful for drive
partitioning schemes. |