mov bx, Handle ;handle of file or device
mov ax, 4406h ;Check Device Input Status
int 21h
jc error_handler ;carry set means error
cmp al, 0FFh ;0FFh means file or device is ready
jne not_ready
Check Device Input Status (Function 4406h) determines whether a file or device is ready for input.
Handle
Identifies the file or device to check.
If the function is successful, the carry flag is clear and the AL register contains the input-status value. 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 |
The meaning of the input-status value depends on whether the handle specifies a file or a device, as shown in the following table:
Status | Device | File |
00h | Not ready | File pointer at end of file |
0FFh | Ready | Ready |
Function 4407h Check Device Output Status