mov bx, Handle ;handle of file or device
mov dx, DevStatus ;device-status value
mov ax, 4401h ;Set Device Data
int 21h
jc error_handler ;carry set means error
Set Device Data (Function 4401h) tells MS-DOS how to use the device referenced by the specified handle. This function cannot change how MS-DOS uses a file.
Handle
Identifies the device to set information for.
DevStatus
Specifies the device-status value. Bit 7 must be 1, to indicate that the specified handle refers to a device, and other bits can be set as follows:
Bits | Meaning |
0 | 1 = Console input device |
1 | 1 = Console output device |
2 | 1 = Null device |
3 | 1 = Clock device |
4 | 1 = Special device |
5 | 1 = Binary mode, 0 = ASCII mode |
6 | 0 = End of file returned if device is read |
All other bits must be set to zero.
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:
Value | Name |
0001h | ERROR_INVALID_FUNCTION |
0005h | ERROR_ACCESS_DENIED |
0006h | ERROR_INVALID_HANDLE |
000Dh | ERROR_INVALID_DATA |
Function 4400h Get Device Data