The Device I/O Control (44H) function performs operations for setting or obtaining information for input and output from character and block devices. The operation performed depends on the value supplied in register AL on entry. The table on the following page lists these values, and their associated operations.
|
Value of AL |
Operation performed |
|
00H |
Obtain information about a device |
|
01H |
Set information for a device |
|
02H |
Receive a control string from a character device driver |
|
03H |
Send a control string to a character device driver |
|
04H |
Receive a control string from a block device driver |
|
05H |
Send a control string to a block device driver |
|
06H |
Enables application to check directly whether the device is ready for input |
|
07H |
Enables application to check directly whether the device is ready for output |
|
08H |
Checks whether the media on a block device is removable |
|
09H |
Determines whether the device is networked |
|
0AH |
Checks whether a handle refers to a local or a networked device |
|
0BH |
Controls retries on sharing and lock resource conflicts |
|
0CH |
Supports code page switching |
|
0DH |
Enables an application to request the device driver to perform functions (described later in the specification) on a block device |
|
0EH |
Checks whether there is more than one logical drive assigned to a block device and which was the last drive to be used |
|
0FH |
Sets the number of the next logical drive for use on a block device |
The entry and return values for each operation are described fully on the following pages.
|
Entry Parameters: | ||
|
Register AH: |
44H | |
|
AL: |
00H to get device information01H to set device information | |
|
BX:DH:DL: |
Handle0 when AL=1Device information when AL=1 | |
|
Returned Values: | ||
|
Register DX: |
Device information | |
The device information returned in DX has two forms:
Table A 1
Information Returned for Character Device
|
bit number | ||
|
0 |
ISCIN = 1 if console input device | |
|
1 |
ISCOT = 1 if console output device | |
|
2 |
ISNUL = 1 if null device | |
|
3 |
ISCLK = if clock device | |
|
4 |
Reserved | |
|
5 |
BINARY | |
|
6 |
EOF = 0 if end-of-file on input | |
|
7 |
ISDEV = 1 channel is a device | |
|
8-12 |
Reserved | |
|
13 |
Output until busy | |
|
14 |
CTRL = 1 if device can process control strings | |
|
15 |
Reserved | |
Table A 2
Information Returned for a Disk File
|
bit number | ||
|
0-5 |
Block device number for the channel (0=A, 1=B, and so on) | |
|
6 |
EOF = 0 if channel has been written to | |
|
7 |
ISDEV = 0 if channel is a disk file | |
|
8-15 |
Not used (set to 0) | |
|
Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 02H to Read | |
| 03H to Write | ||
| BX: | Handle | |
| CX: | Number of bytes to be read or written | |
| DS: | Data or Buffer - Segment | |
| DX: | Data or Buffer - Offset | |
|
Returned Values: | ||
| Register | AX: | Number of transferred bytes |
If the IOCTRL bit in the device driver header is zero, an Invalid Function error is returned (see Figures 6-2 and 6-3).
Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 04H to Read | |
| 05H to Write | ||
| BL: | Drive number (0 = default,1 = A, 2 = B, and so on) | |
| CX: | Number of bytes to be read or written | |
| DS: | Data or Buffer - Segment | |
| DX: | Data or Buffer - Offset | |
|
Returned Values: | ||
| Register | AX: | Number of transferred bytes |
If the IOCTRL bit in the device driver header is zero, an Invalid Function error is returned (see Figures 6-2 and 6-3). If the drive is invalid, an Access Denied error is returned.
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 06H to get input status | |
| 07H to get output status | ||
| BX: | Handle | |
| Returned Values: | ||
| Register | AL: | If device, FFH = ready, 00H = not ready if a file, FFH until end-of-file, 00H thereafter |
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 08H | |
| BL: | Drive number ( 0 = default, 1 = A, 2 = B and so on) | |
| Returned Values: | ||
| Register | AX: | 00H if device is removable 01H if device is fixed 0FH if drive number is invalid |
If the device checked is part of a network, the error Invalid Function is returned.
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 09H | |
| BL: | Drive number ( 0 = default, 1 = A, 2 = B and so on) | |
| Returned Values: | ||
| Register | DX: | Bit 12 = 0 if a local device Bit 12 = 1 if a remote device the other DX bits are reserved. |
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 0AH | |
| BX: | Handle | |
| Returned Values: | ||
| Register | DX: | Bit 15 = 0 if handle is for a local device Bit 15 = 1 if handle is for a remote device |
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 0BH - Change sharing retry count | |
| CX: | Number of times to execute a delay loop | |
| DX: | Number of retries | |
| Returned Values: | ||
| Register | AX: | Error code if Carry flag is set |
This call sets the number of times a disk operation is retried after a failure caused by a file-sharing violation before it returns a DOS error or a critical error. You can select both the number of retries and the delay time between retries. On input, register CX contains the number of times to execute a delay loop, and DX contains the number of retries.
| Entry Parameters: | ||
| Register | AH: | 44H - IOCTL Request |
| AL: | 0CH - Handle Generic IOCTL(Code page switching) | |
| BX: | Handle | |
| CH: | Category code (device type) | |
| 00 - Unknown | ||
| 01 - COMx | ||
| 03 - CON | ||
| 05 - LPTx | ||
| CL: | Function within category code (Minor code) | |
| 4CH = Prepare start | ||
| 4DH = Prepare end | ||
| 4AH = Select | ||
| 6AH = Query selected | ||
| 6BH = Query prepare list | ||
| DS:DX | Pointer to parameter block | |
| Returned Values: | ||
| Register | AX: | Error code if the Carry flag is set. |
This call allows a device driver to support a set of subfunction calls that implement code page switching.
Refresh requests the device driver to set up the device with the most recently selected code page. The refresh operation is requested by doing a Prepare Start with all the CODEPAGE fields set to a -1 (see the structure of the Prepare Start parameter block in section A.10.1). This operation must be followed immediately by a Prepare End.
If the operation is successful, many of the function calls return the Carry flag clear. If an error condition was encountered, the Carry flag is set. Issue the Get Extended Error (59H) call to determine the actual error condition.
After a Prepare Start, data defining the code page font is written to the driver using one or more Send Control String (AX = 4403H) calls. This is assumed to be information to download to the device.
The stream is ended by a Prepare End. The stream format is device specific.
If no data is written for a prepare operation, the driver is to interpret the newly prepared code page(s) as a hardware code page. This allows devices that support user changeable hardware fonts (usually in cartridges) to be supported.
A prepare is not needed for hardware-defined code pages.
When CL = 4AH (Select), 4DH (Prepare End), or 6BH (Query Prepare List) the parameter block, pointed to by DS:DX, has the layout shown below.

Figure A-1
Parameter Block for Select, Prepare End, and Query Prepare List
When CL = 4CH, the parameter block, pointed to by DS:DX, has the layout shown below.

Figure A-2
Parameter Block for Prepare Start
PAGETOT specifies the number of additional code pages given in the DEVICE command in CONFIG.SYS. The maximum value for PAGETOT is 12.
A value of -1 for any CODEPAGE field tells the device driver not to change the code page value for that position. Any other value is a codepage to be prepared.
For cartridge-prepares set FLAGS to 1.
When CL = 6AH, the parameter block, pointed to by DS:DX, has the layout shown below.

Figure A-3
Parameter Block for Query Selected
There can be a maximum of 12 hardware code pages, and a maximum of 12 prepared code pages.
The table below shows the possible error codes returned from Get Extended Error for code page switching operations. The meanings of the codes are different to the standard interpretations described in Chapter 5, Error Handling.
|
Code |
Meaning | |
|
Prepare Start Error Codes | ||
|
01 |
Invalid function number | |
|
27 |
Code page conflict (used for keyb xx mismatch) | |
|
29 |
Device error | |
|
22 |
Unknown command | |
|
Send Control String Error Codes | ||
|
27 |
Device not found in file, or code page not found in file | |
|
29 |
Device error | |
|
31 |
File contents not a font file, or file contents structure damaged | |
|
Prepare End Error Codes | ||
|
19 |
Bad data read from font file | |
|
31 |
No prepare start | |
|
Select Error Codes | ||
|
26 |
Code page not prepared | |
|
27 |
Current keyb does not support this code page | |
|
29 |
Device error | |
|
Query Selected Error Codes | ||
|
26 |
No code page has been selected | |
|
27 |
Device error | |
|
Query Prepared List Error Codes | ||
|
27 |
Keyboard/code page conflict | |
|
29 |
Device error | |
|
31 |
Device driver does not have copy of code page to download to device | |
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 0DH | |
| BL: | Drive number (0 = default drive, 1 = A, 2 = B, and so on) | |
| CH: | 08H - category code | |
| CL: | Function code:
40H - Set block device parameters 60H - Get block device parameters 41H - Write to track on logical device 61H - Read from track on logical device 42H - Format and verify track on a logical device 62H - Verify without formatting 46h - Set media ID 66h - Get media ID | |
| DS: | Data or Buffer - Segment | |
| DX: | Data or Buffer - Offset | |
This call tells block device drivers to perform one of the following instructions:
Register CH contains the category code (08H for all functions), and CL contains the function code.
When CL = 60H or CL = 40H, the parameter block has the layout shown below.

Figure A-4
Parameter Block for Get or Set Device Parameters
FUNCTION is a 1-byte field that further defines the functions of Get and Set Device Parameters.
It is invalid to set bits 0 and 1 at the same time, and this should be considered an error.
Set bit 2 for normal track layouts. Format Track can be more efficient if bit 2 is set.
DEVICE is a 1-byte field that descibes the physical device type. This field must be set to the correct value when calling Set Device Parameters. The values in this field have the following meanings:
| 0 | 320/360Kb, 5 1/4 - inch disk |
| 1 | 1.2Mb, 5 1/4 - inch disk |
| 2 | 720Kb, 3 1/2 - inch disk |
| 3 | 8- inch single density disk |
| 4 | 8- inch double density |
| 5 | Fixed disk |
| 6 | Tape drive |
| 7 | 1.4Mb, 3 1/2 - inch disk |
| 8 | Other |
DEV_ATTR is a 1-byte field that describes the physical attributes of the device. This field must be set to the correct value when calling Set Device Parameters.
Only bits 0 and 1 of this field are used. They have the following meanings:
| Bit 0 | = 1 | Nonremovable media. |
| = 0 | Removable media. | |
| Bit 1 | = 1 | Diskette changeline is supported. |
| = 0 | Diskette changeline is not supported. | |
| Bits 2 - 7 are reserved. | ||
CYLINDERS specifies the maximum number of cylinders that can be supported on the physical device, independent of the media type. This field must be set to the correct value when calling Set Device Parameters.
For multimedia drives, the MEDIA field indicates which media is expected to be in the drive.
The MEDIA field is used only when the actual media in the drive cannot otherwise be determined. Media type is dependent on device type.
Regardless of the device type, a value of 0 represents the default. For example, a 5 1/4 - inch 1.2Mb diskette drive is a multi-media drive. The media type is defined as follows:
0 = High density 1.2 Mb (96 tpi) diskette
1 = Double density 320/360 Kb (48 tpi) diskette
The default media type for a 1.2 Mb drive is a high density
1.2Mb diskette.
For the Get Device Parameters function, bit 0 of the FUNCTION field has the following effect:
| Bit 0 | = 1 | The device driver returns the BPB that BUILD BPB would return. |
| = 0 | The device driver returns the default BPB for the device. | |
| For the Set Device Parameters function, bit 0 of the FUNCTION field has the following effect: | ||
| Bit 0 | = 1 | The device driver is requested to return the BPB from this field for all subsequent BUILD BPB requests until a Set Device Parameters request is received with bit 0 in the FUNCTION field reset. |
| = 0 | The BPB contained in this field becomes the new default BPB for the device. | |
Figure A-5
Format of the DEVBPB Field
LAYOUT is a variable length table that indicates the expected layout of sectors on the media track.
DOS device drivers do not keep a track layout table for each logical device. The global track table must be updated, using via Set Device Parameters, when the attributes of the media change.
Note that the Set Device Parameters call (CL = 40H) modifies the track table irrespective of how bit 1 of the FUNCTION field is set.
The LAYOUT field is not used for the Get Device Parameters function, but the track layout is used by subsequent Read/Write Track, Format/Verify Track and Verify Track functions.
Figure A-6 shows how the LAYOUT field is formatted.

Figure A-6
Format of the LAYOUT Field
The COUNT field specifies the total number of sectors. Each sector number must be unique and in a range between 1 and n (sector count). The first sector number is 1 and the last sector number is equal to the sector count (n). Sector sizes are measured in bytes. If bit 2 of the FUNCTION field is set, all sector sizes must be the same.
Example contents in LAYOUT might be:
| Field | Content |
|---|---|
| COUNT | 2 |
| SECTOR_NUMBER1 | 1H |
| SECTOR_SIZE1 | 200H |
| SECTOR_NUMBER | 22H |
| SECTOR_SIZE2 | 200H |
| SECTOR_NUMBERn | nH |
| SECTOR_SIZE | 200H |
See the description of the FUNCTION field, bit 2.
Note that you should change the DEVICE, DEV_ATTR, and MAX_CYL fields only if the physical device has been changed.
When CL = 41H (Read Track on Logical Device) or CL = 61H (Write Track on Logical Device), the parameter block has the layout shown below.

Figure A-7
Parameter Block for Read/Write Track on Logical Device
All bits in the FUNCTION field must be reset before a Read or Write Track on Logical Device function is called.
The value in the FIRST_SECTOR, CYLINDER , and HEAD fields starts at zero. For example, to indicate sector 9, set the value to 8.
When CL = 42H (Format/Verify Track on Logical Drive) or CL = 62H (Format Track on Logical Device), the parameter block has the layout shown below.

Figure A-8
Parameter Block for Format/Verify Track on Logical Drive
On entry, bit 0 of the FUNCTION field has the following effect:
To format a track:
| Entry Parameters: | |||
| Register | AH: | 44H | |
| AL: | 0EH | ||
| BL: | Drive number (0 = default, 1 = A, 2 = B,and so on) | ||
| Returned Values: | |||
| Register | AL: | Drive number (0 if only one driveassigned) | |
| AX: | Error code if Carry flag is set | ||
This call allows the device driver to determine if more than one logical drive is assigned to a block device. When the call is issued, a drive number is passed in BL on input.
If the block device has more than one logical drive letter assigned to it, on output a drive number corresponding to the last drive letter that was used to reference the device is returned in AL. If only one drive letter is assigned to the device, 0 is returned in AL by this call.
| Entry Parameters: | ||
| Register | AH: | 44H |
| AL: | 0FH | |
| BL: | Drive number (0 = default, 1 = A, 2 = B,and so on) | |
| Returned Values: | ||
| Register | AL: | Drive number (0 if only one driveassigned) |
| AX: | Error code if Carry flag is set | |
[Front] [Prev Chapter] [Next Chapter]