Int 21H [2.0] Function 44H (68) Subfunction 05H IOCTL: write control data to block-device driver

Transfers control data from an application program directly to a block-device driver. The length and contents of the control data are specific to each device driver and do not follow any standard format. This function does not necessarily result in any output to the physical device.

Call with:

AH = 44H

AL = 05H

BL = drive code (0 = default, 1 = A, 2 = B, etc.)

CX = number of bytes to write

DS:DX = segment:offset of data

Returns:

If function successful

Carry flag = clear

AX = bytes transferred

If function unsuccessful

Carry flag = set

AX = error code

Notes:

When supported by the driver, this subfunction can be used to request hardware-dependent operations (such as tape rewind or disk eject) that are not provided by other MS-DOS function calls.

Block-device drivers are not required to support IOCTL Subfunction 05H. If this subfunction is requested and the driver does not have the ability to process control data, control returns to the program with the carry flag set and error code 0001H (invalid function) in register AX.

Example:

Write a control string from the buffer buff to the block-device driver for drive C. The length of the string is assumed to be in the variable ctllen.

buflen equ 64 ; length of buffer

ctllen dw ? ; length of control data

buff db buflen dup (?) ; contains control data

.

.

.

mov ax,4405h ; function & subfunction

mov bl,3 ; drive C = 3

mov dx,seg buff ; buffer address

mov ds,dx

mov dx,offset buff

mov cx,ctllen ; length of control data

int 21h ; transfer to MS-DOS

jc error ; jump if write failed

.

.

.