Int 21h/AH=02h

DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT

AH = 02h
DL = character to write

Return:
AL = last character output (despite the official docs which state nothing is returned) (at least DOS 2.1-7.0)

Notes: ^C/^Break are checked, and INT 23 executed if pressed. Standard output is always the screen under DOS 1.x, but may be redirected under DOS 2+. The last character output will be the character in DL unless DL=09h on entry, in which case AL=20h as tabs are expanded to blanks. If standard output is redirected to a file, no error checks (write- protected, full media, etc.) are performed


Int 21h/AH=08h

DOS 1+ - CHARACTER INPUT WITHOUT ECHO

AH = 08h

Return:
AL = character read from standard input

Notes: ^C/^Break are checked, and INT 23 executed if detected. Standard input is always the keyboard under DOS 1.x, but may be redirected under DOS 2+. If the interim console flag is set (see AX=6301h), partially-formed double-byte characters may be returned


Int 21h/AH=09h

DOS 1+ - WRITE STRING TO STANDARD OUTPUT

AH = 09h
DS:DX -> '$'-terminated string
Return:
AL = 24h (the '$' terminating the string, despite official docs which state that nothing is returned) (at least DOS 2.1-7.0 and NWDOS)

Notes: ^C/^Break are checked, and INT 23 is called if either pressed. Standard output is always the screen under DOS 1.x, but may be redirected under DOS 2+. 


Int 21h/AH=1Ah

DOS 1+ - SET DISK TRANSFER AREA ADDRESS

AH = 1Ah
DS:DX -> Disk Transfer Area (DTA)
Notes: The DTA is set to PSP:0080h when a program is started. Under the FlashTek X-32 DOS extender, the pointer is in DS:EDX

Int 21h/AH=3Dh

DOS 2+ - OPEN - OPEN EXISTING FILE

AH = 3Dh
AL = access and sharing modes (see #1267)
DS:DX -> ASCIZ filename
CL = attribute mask of files to look for (server call only)

Return:
CF clear if successful AX = file handle CF set on error AX = error code (01h,02h,03h,04h,05h,0Ch,56h) (see #1545 at AH=59h)

Notes: File pointer is set to start of file. 


Int 21h/AH=3Fh

DOS 2+ - READ - READ FROM FILE OR DEVICE

AH = 3Fh
BX = file handle
CX = number of bytes to read
DS:DX -> buffer for data
Return:
CF clear if successful AX = number of bytes actually read (0 if at EOF before call) CF set on error AX = error code (05h,06h) (see #1545 at AH=59h/BX=0000h)

Notes: Data is read beginning at current file position, and the file position is updated after a successful read. The returned AX may be smaller than the request in CX if a partial read occurred. If reading from CON, read stops at first CR. Under the FlashTek X-32 DOS extender, the pointer is in DS:EDX


Int 21h/AH=4Eh

DOS 2+ - FINDFIRST - FIND FIRST MATCHING FILE

AH = 4Eh
AL = special flag for use by APPEND (refer to note below)
CX = file attribute mask (see #1285 at AX=4301h) (bits 0 and 5 ignored)
DS:DX -> ASCIZ file specification (may include path and wildcards)

Return:
CF clear if successful Disk Transfer Area filled with FindFirst data block (see #1491) CF set on error AX = error code (02h,03h,12h) (see #1545 at AH=59h/BX=0000h)

Format of FindFirst data block:

Offset  Size    Description     (Table 1491)
00h    BYTE    drive letter (bits 0-6), remote if bit 7 set
01h 11 BYTEs   search template
0Ch    BYTE    search attributes
0Dh    WORD    entry count within directory
0Fh    DWORD   pointer to DTA???
13h    WORD    cluster number of start of parent directory
15h    BYTE    attribute of file found
16h    WORD    file time (see below)
18h    WORD    file date (see below)
1Ah    DWORD   file size
1Eh 13 BYTEs   ASCIZ filename+extension.
Bitfields for file time: 
Bit(s) Description 
15-11 hours (0-23) 
10-5 minutes 
4-0 seconds/2
Bitfields for file date: 
Bit(s) Description 
15-9 year - 1980 
8-5 month 
4-0 day

Int 21h/AH=4Fh

DOS 2+ - FINDNEXT - FIND NEXT MATCHING FILE

AH = 4Fh
Disk Transfer Area contains data block from previous FindFirst or
FindNext call
Return:
CF clear if successful Disk Transfer Area updated CF set on error AX = error code (12h) (see #1545 at AH=59h/BX=0000h)