Content deleted Content added
clearify ; additions |
→Common DOS services: Added basic file operations |
||
Line 15:
{|class="wikitable"
!Subfunction <br />(hex)
!Service▼
!Parameters
!Returns
▲!Service
|-
|AH =
| Terminate program
|
| Never
|-
| AH =
| Read character from [[Standard streams#Standard input (stdin)|STDIN]]
|
| AL=character read
|-
| AH =
| Write to character to [[Standard streams#Standard input (stdout)|STDOUT]]
| DL=character
|
|-
| AH =
| Write string
| DS:DX=pointer to '$' terminated string |
|-
| AH = 3C
| DOS 2+<br />Create or truncate file
| CX = file attributes, DS:DX -> [[C string|ASCIZ]] filename
| [[Carry flag|CF]] clear if successful ; AX = [[File descriptor|file handle]] ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2778">{{cite web|title=Int 21/AH=3Ch|url=http://www.ctyme.com/intr/rb-2778.htm}} 090911 ctyme.com</ref>
|-
| AH = 3D
| DOS 2+<br />Open existing file
| AL = access and sharing modes ; DS:DX -> ASCIZ filename ; CL = attribute mask
| CF clear if successful ; AX = file handle ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2779">{{cite web|title=Int 21/AH=3Dh|url=http://www.ctyme.com/intr/rb-2779.htm}} 090911 ctyme.com</ref>
|-
| AH = 3F
| DOS 2+<br />Read from file or device
| BX = [[File descriptor|file handle]] ; CX = bytes to read ;DS:DX -> buffer for data
| CF clear if successful ; AX = bytes read ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2783">{{cite web|title=Int 21/AH=3Fh|url=http://www.ctyme.com/intr/rb-2783.htm}} 090911 ctyme.com</ref>
|-
| AH = 40
| DOS 2+<br />Write to file or device
| BX = file handle ; CX = bytes to write ; DS:DX -> data
| CF clear if successful ; AX = bytes written ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2791">{{cite web|title=Int 21/AH=40h|url=http://www.ctyme.com/intr/rb-2791.htm}} 090911 ctyme.com</ref>
|-
| AH = 3E
| DOS 2+<br />Close file
| BX = file handle
| CF clear if successful ; AX destroyed ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2782">{{cite web|title=Int 21/AH=3Eh|url=http://www.ctyme.com/intr/rb-2782.htm}} 090911 ctyme.com</ref>
|-
| AH = 42
| DOS 2+<br />Lseek - Set fileposition
| AL = origin of move, 0-start, 1-current, 2-end ; BX = file handle ; CX:DX = (signed) offset
| CF clear if successful ; DX:AX = new position in bytes from start of file ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2799">{{cite web|title=Int 21/AH=42h|url=http://www.ctyme.com/intr/rb-2799.htm}} 090911 ctyme.com</ref>
|}
|