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

Transfers control data from an application to a character-device driver. The length and contents of the 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 = 03H

BX = handle

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:

If supported by the driver, this subfunction can be used to request hardware-dependent operations (such as setting baud rate for a serial port) that are not supported by other MS-DOS function calls.

Character-device drivers are not required to support IOCTL Subfunction 03H. A program can test bit 14 of the device information word returned by IOCTL Subfunction 00H to determine whether the driver supports this subfunction. If Subfunction 03H 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 standard list device driver. The length of the string is assumed to be in the variable ctllen.

stdprn equ 4 ; standard list handle

buflen equ 64 ; length of buffer

ctllen dw ? ; length of control data

buff db buflen dup (?) ; contains control data

.

.

.

mov ax,4403h ; function & subfunction

mov bx,stdprn ; standard list handle

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

.

.

.