Function 13H (19) Generic IOCTL

The generic IOCTL function is supported only under MS-DOS versions 3.2 and later and is called only if bit 6 is set in the device attribute word of the device header. This function corresponds to the MS-DOS generic IOCTL service supplied to application programs by Int 21H Function 44H Subfunctions 0CH and 0DH.

The generic IOCTL function is passed a category (major) code, a function (minor) code, the contents of the SI and DI registers at the point of the IOCTL call, and the segment and offset of a data buffer. This buffer in turn contains other information whose format depends on the major and minor IOCTL codes passed in the request header. The driver must interpret the major and minor codes in the request header and the contents of the additional buffer to determine which operation it will carry out, then set the done flag in the request-header status word, and return any other applicable information in the request header or the data buffer.

Services that the generic IOCTL function may invoke, if the driver supports them, include configuration of the driver for nonstandard disk formats, reading and writing entire disk tracks of data, and formatting and verifying tracks. The generic IOCTL function has been designed to be open-ended, so that it can be used to easily extend the device-driver definition under future versions of MS-DOS.

The generic IOCTL function is called with

RH + 1 BYTE Unit number (block devices)

RH + 2 BYTE Command code = 19 (13H)

RH + 13 BYTE Category (major) code

RH + 14 BYTE Function (minor) code

RH + 15 WORD SI register contents

RH + 17 WORD DI register contents

RH + 19 DWORD Address of generic IOCTL data packet

It returns

RH + 3 WORD Status