MEDIAREQUEST STRUC
mrLength db ? ;length of record, in bytes
mrUnit db ? ;unit number
mrFunction db 01h ;function number
mrStatus dw ? ;status
mrReserved db 8 dup(?) ;reserved
mrMediaID db ? ;INPUT: current media descriptor
mrReturn db ? ;OUTPUT: return value
mrVolumeID dd ? ;OUTPUT: previous volume identifier
MEDIAREQUEST ENDS
Media Check (Device-Driver Function 01h) determines whether the medium in the specified drive has changed.
This function is required by block-device drivers only.
mrLength
Specifies the length, in bytes, of the MEDIAREQUEST structure.
mrUnit
Specifies the unit for which the medium is to be checked.
mrFunction
Specifies the Media Check function: 01h.
mrStatus
Specifies the status of the completed function. If the function is successful, the driver must set the done bit (bit 8). Otherwise, the driver must set both the error and done bits (bits 15 and 8) and copy an error value to the low-order byte.
mrReserved
Reserved; do not use.
mrMediaID
Specifies the media descriptor for the medium MS-DOS assumes is in the drive. 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). |
mrReturn
Receives a return value identifying whether the medium has changed. The driver must set the field to one of the following values:
Value | Meaning |
0FFh | Medium has been changed. |
00h | Driver cannot determine whether medium has been changed. |
01h | Medium is unchanged. |
mrVolumeID
Receives the 32-bit address (segment:offset) of a zero-terminated ASCII string specifying the volume identifier of the previous disk in the drive. The driver must set this field to the address of the volume identifier. If the disk does not have a volume identifier, the driver must set the field to the address of the string “NO NAME”.
If the medium in the drive has not changed, MS-DOS proceeds with the disk operation.
If the medium in the drive has changed, MS-DOS invalidates all buffers associated with the drive, including any buffers containing data waiting to be written (this data is lost). MS-DOS then calls Build BPB (Device-Driver Function 02h) to request a BPB structure for the new disk and reads the disk's file allocation table (FAT) and directory.
If the driver cannot determine whether the disk has changed, MS-DOS checks its internal disk buffers. If data is waiting to be written to the disk, the system assumes that the disk has not changed and attempts to write the data to the disk. If the disk buffers are empty, MS-DOS assumes the disk has changed and updates the disk information as if the driver had returned 0FFh.
Device-Driver Function 02h Build BPB