DOS API: Difference between revisions

Content deleted Content added
Electron9 (talk | contribs)
links ; details
Electron9 (talk | contribs)
Common DOS services: trim ; present since 2.0
Line 12:
 
==Common DOS services==
Some basic INT 21h function calls present since DOS version 12.0:
 
{|class="wikitable"
! Subfunction <br /><small>(hex)</small>
! Service
! Parameters
! Returns
|-
| AH = 00 || TerminateDOS program1+<br />{{nowrap||Terminate || Neverprogram}}
| Never <ref name="ctyme2551">{{cite web|title=Int 21/AH=00h|url=http://www.ctyme.com/intr/rb-2551.htm}} 090912 ctyme.com</ref>
|-
| AH = 01
| DOS 1+<br />{{nowrap|Read character from [[Standard streams#Standard input (stdin)|STDIN]]}}
|
| AL=character read <ref name="ctyme2552">{{cite web|title=Int 21/AH=01h|url=http://www.ctyme.com/intr/rb-2552.htm}} 090912 ctyme.com</ref>
| AL=character read
|-
| AH = 02
| DOS 1+<br />{{nowrap|Write to character to [[Standard streams#Standard input (stdout)|STDOUT]]}}
| DL=character
| <ref name="ctym2554">{{cite web|title=Int 21/AH=02h|url=http://www.ctyme.com/intr/rb-2554.htm}} 090912 ctyme.com</ref>
|-
| AH = 09
| DOS 1+<br />{{nowrap|Write string}}
| DS:DX=pointer to '$' terminated string
| <ref name="ctyme2562">{{cite web|title=Int 21/AH=09h|url=http://www.ctyme.com/intr/rb-2562.htm}} 090912 ctyme.com</ref>
|
|-
| AH = 3C
| DOS 2+<br />Create or truncate file
| CX = file attributes, ; {{nowrap|DS:DX -> [[C string|ASCIZ]] filename}}
| [[Carry flag|CF]]=1 clearon iferror successful; AX=error code ; AX = [[File descriptor|file handle]] ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2778ctyme2778">{{cite web|title=Int 21/AH=3Ch, Creat|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 ; {{nowrap|CL = attribute mask}}
| CF=1 clearon if successfulerror ; AX =error file handle ; CF set on errorcode ; AX =file errorhandle code<ref name="ctyme_com-rb-2779ctyme2779">{{cite web|title=Int 21/AH=3Dh, Open|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]] ; {{nowrap|CX = &#61;bytes to read}} ; DS:DX -> buffer for data
| CF=1 clearon if successfulerror ; AX = bytes read ; CF set on error ;code AXor =bytes errorread code<ref name="ctyme_com-rb-2783ctyme2783">{{cite web|title=Int 21/AH=3Fh, Read|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=1 clearon if successfulerror ; AX = bytes written ; CF set on error ;code AXor =bytes errorwritten code<ref name="ctyme_com-rb-2791ctyme2791">{{cite web|title=Int 21/AH=40h, Write|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=1 on error ; AX = error code <ref name="ctyme_com-rb-2782ctyme2782">{{cite web|title=Int 21/AH=3Eh, Close|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=1 clearon iferror successful; AX=error code ; DX:AX = new position in bytes from startbeginning of file ; CF set on error ; AX = error code<ref name="ctyme_com-rb-2799ctyme2799">{{cite web|title=Int 21/AH=42h, Lseek|url=http://www.ctyme.com/intr/rb-2799.htm}} 090911 ctyme.com</ref>
|}