Write/Write with Verify (Device-Driver Functions 08h and 09h)

READWRITEREQUEST STRUC

rwrLength db ? ;length of record, in bytes

rwrUnit db ? ;unit number

rwrFunction db ? ;function number

rwrStatus dw ? ;status

rwrReserved db 8 dup(?) ;reserved

rwrMediaID db ? ;INPUT: media descriptor

rwrBuffer dd ? ;INPUT: buffer address

rwrBytesSec dw ? ;INPUT: number bytes/sectors to write

;OUTPUT: number bytes/sectors written

rwrStartSec dw ? ;INPUT: starting-sector number

rwrVolumeID dd ? ;OUTPUT: volume identifier

rwrHugeStartSec dd ? ;INPUT: 32-bit starting-sector number

READWRITEREQUEST ENDS

Write (Device-Driver Function 08h) and Write with Verify (Device-Driver Function 09h) transfer data from the specified buffer to a device. Write with Verify also reads the data back from the device, if possible, to verify that the data has been transferred correctly.

This function is required for both block- and character-device drivers.

Fields

rwrLength

Specifies the length, in bytes, of the READWRITEREQUEST structure.

rwrUnit

Specifies the device to which data is to be written. This field is used for block-device drivers only.

rwrFunction

Specifies the Write or Write with Verify function: either 08h or 09h.

rwrStatus

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.

rwrReserved

Reserved; do not use.

rwrMediaID

Specifies the media descriptor for the medium that MS-DOS assumes is in the disk drive. This field can be any one of the media descriptor values specified in Media Check (Device-Driver Function 01h). This field is used for block-device drivers only.

rwrBuffer

Contains the 32-bit address (segment:offset) of the buffer containing the data to write to the device.

rwrBytesSec

Contains the number of bytes or sectors to write and receives the number of bytes or sectors written. The following table describes input and output:

Input/Output Description

Input Specifies the number of bytes to write to a character device, or the number of sectors to write to a block device.
Output Specifies the number of bytes written to a character device, or the number of sectors written to the block device. The driver must set this field; if there is an error, the driver should return the number of bytes or sectors written before the error occurred.

rwrStartSec

Specifies the first logical sector to write. If the first sector is larger than 65,535 bytes, this field contains 0FFFFh and the rwrHugeStartSec field specifies the first sector. This field is used for block-device drivers only.

rwrVolumeID

Contains the 32-bit address (segment:offset) of a zero-terminated ASCII string specifying the volume identifier for the most recently accessed disk. If the driver also returns error value 0Fh (invalid disk change), MS-DOS uses the volume identifier to prompt the user to insert the appropriate disk. This field is used for block-device drivers only.

rwrHugeStartSec

Specifies the first logical sector to write. This field is used only if the rwrStartSec field contains 0FFFFh. This field is used for block-device drivers only.

Comments

The driver must translate the logical-sector number supplied in the rwrStartSec or rwrHugeStartSec field to the appropriate head, track, and sector numbers.

The rwrHugeStartSec field is used only if bit 1 is set in the dhAttributes field in the block-device driver's DEVICEHEADER structure. For a full description of the DEVICEHEADER structure, see Section 9.9, “Structures.”

See Also

Device-Driver Function 01h Media Check
Device-Driver Function 04h Read
Interrupt 21h Function 40h Write File or Device