DOS system call Summary
--------------------------------------------------------------------------------
XXXX 1. Summary
Figure 1 XXXX lists the five dos interrupt functions, among which 21 h is the most useful. It provides a general portal to access almost all DoS functions. 25 h and 26 h are interrupted. Absolute disk read/write interfaces are often used to bypass DOS file interfaces. The remaining interruptions, 20 h and 27 h, are the program termination and resident services provided by DOS version 1. This function has been deprecated after it is interrupted for 21 h in DOS version 2.0.
When there are too many threads, there are too many threads, too many threads
Interrupted
Hexadecimal decimal description
When there are too many threads, there are too many threads, too many threads
20 h 32 program termination: normal completion
21 H 33 General Dos call
25 3 absolute disk read
26 h 38 absolute disk write
27 h 39 termination and resident
When there are too many threads, there are too many threads, too many threads
Figure 1 five major dos interruptions
Figure 2 details the 21h interrupt function provided by DOS version 1 and supported for all later versions.
When there are too many threads, there are too many threads, too many threads
Function
Hexadecimal decimal description
When there are too many threads, there are too many threads, too many threads
00 H 0 program termination
01 H 1 bring back the explicit Character Input
02 H 2 character output
03 H 3 auxiliary input
04 H 4 secondary output
05 H 5 Printer output
When there are too many threads, there are too many threads, too many threads
Figure 2 21h interrupt function provided by all DoS versions
When there are too many threads, there are too many threads, too many threads
06 h 6 Input/Output
07 H 7 do not bring back explicit direct Character Input
08 h 8 Bring back the explicit Character Input
09 h 9 string output
0ah 10 Keyboard Buffer Input
0ch 12 refresh the Keyboard Buffer and read the keyboard
0dh 13 refresh the disk Buffer
0eh 14 select disk drive persuade
0fh 15 open the file
Close files in 10 H 16
11 H 17 search for the first matched Directory Entry
Search for the next matched directory entry at 12 h 18
13 H 19 Delete Files
14 H 20 sequential read
15 h 21 sequential write
16 H 22 create a file
17 H 23 modify the file name
19 h 25 get the current disk number
1ah 26 set the data transfer area (datav trannfer area) Address 1bh 27 to obtain the default disk Information
Take the specified disk information for 1ch 28
21 H 33 random read records
22 h 34 random write records
23 h 35 get File Size
24 h 36 set the file contorl block field
Set the interrupt vector at 25 H 37
26 h 38 create a new program segment prefix (Program segmentprefix)
27 h 39 random read record Blocks
28 h 40 random write record Blocks
29 H 41 analysis file name
2ah 42 date
2bh 43 set date
2ch 44 fetch time
Set the 2dh 45 Time
2EH 46
When there are too many threads, there are too many threads, too many threads
Figure 3 lists the 21h feature set of extended interruptions provided by DOS 2.0 for later versions.
When there are too many threads, there are too many threads, too many threads
Function
Hexadecimal decimal description DOS version
When there are too many threads, there are too many threads, too many threads
2fh 47 fetch data transfer zone address 2.0
Take the DOS version 2.0 for 30 h 48
31 H 49 termination and resident 2.0
33 H 51 settings/Ctrl-C flag 2.0
35 h 53 get interrupt vector 2.0
36 h 54 fetch free space of disk capacity 2.0
38 H 56 set/retrieve information related to the specified country 2.0
39 h 57 create directory 2.0
3ah 58 Delete directory 2.0
3bh 59 change the current directory 2.0
3ch 60 Create File 2.0
3DH 61 open file 2.0
3eh 62 close file 2.0
3fh 63 read 2.0 from files or devices
40 h 64 write 2.0 to files or devices
41 h 65 delete file 2.0
42 h 66 mobile file metric 2.0
43 H 64 settings/file properties 2.0
44 h 68 IOCTL _ device input/output control 2.0
46 h 69 copy file name handle 2.0
46 h 70 force copy file name handle 2.0
47 h 71 get the current directory 2.0
Memory block allocated for 48 h 72 2.0
49 H 73 release memory block 2.0
4ah 74 modify memory block size 2.0
4bh 75 load and execute program 2.0
4ch 76 terminate the process and give the return code 2.0
4dh 77 get return code 2.0
4eh 78 search for the first matched directory entry 2.0
Search for the next matched directory entry in 4fh 79 2.0
54 h 84 get verification mark 2.0
56 h 86 Modify file name 2.0
57 H 87 set/Get File date and time 2.0
58 h 88 settings/memory fetch allocation policy 3.0
59 H 89 retrieve expanded error message 3.0
5ah 90 create temporary file 3.0
When there are too many threads, there are too many threads, too many threads
Function
Hexadecimal decimal description DOS version
When there are too many threads, there are too many threads, too many threads
5bh 91 create new file 3.0
5ch 92 block/unlock file access zone 3.0
5eh 94 network machine name and printer settings 3.1
5fh 95 Network redirection 3.1
62 h 98 get the program segment prefix 3.0
65 H 101 fetch extended country information 3.3
66 h 102 set/retrieve global code page 3.3
67 h 103 set/retrieve global code page 3.3
67 h 103 set file handle count 3.3
68 h 104 submit file 3.3
When there are too many threads, there are too many threads, too many threads
XXXX can use all the 21 h interrupt functions by calling the 21 h interrupt function. When used, the function number is stored in register ah, and other parameters need to be placed in other registers of 8086; most dos functions return a completion code in Al or ax; most of the functions provided after DOS version 2.0 are also commonly used with the carry mark delivery function call success mark.
Xxxx ii. Detailed List
In XXXX, we briefly list all DoS functions, so that the function numbers can be used to conveniently find various functions. In this section, we will detail the changes in the register value when the 21h feature is interrupted (that is, when this interrupt is used, the value sent from the register to the interrupt 21h and the value returned from the interrupt 21h ).
Many new dos versions provide functions not available in previous versions. Therefore, the DOS version number is displayed when the function is introduced.
DOS interruption 21 H function Summary
When there are too many other users, there are too many other users, too many other users.
Function number register DoS
Comment on the input/output version number of the interrupted service (in hexadecimal format)
When there are too many other users, there are too many other users, too many other users.
1. program control functions
When there are too many other users, there are too many other users, too many other users.
Termination:
End program 00 h Ah = 00 h 1.0 expired: replaced by function 4ch
Cs = PSP segment address
── ─
Create a new process
26 h Ah = 26 h 1.0 out of date: replaced by 4bh
DX = segment address starting with the new PSP
── ─
Termination and resident
Leave 31 H Ah = 31 H 2.0
Al = return code
DX = field number of the resident memory segment
── ─
Set/take Ctrl-C
Mark 33 H Ah = 33 H flag: Al = 01 h dl = Flag Value Flag:
Al = 00 h Al = result code if Al = 01 H is called, DL = Current flag value (0 = OFF, 1 = on) 2.0
── ─
Exec: load and execute the program 4bh Ah = 4bh DS: DX → asciiz
Command Line Segment: displacement ES: BX → control block execution subroutine segment:
Al = 00 h loading without executing: Al = 03 H if no error occurs, clear the CF bit. If an error occurs, set the CF bit and the Ax = error code;
2.0 modify all registers including SS: SP
── ─
Terminate the process and provide the return code 4ch Ah = 4ch Al = return code 2.0
Obtain the 4dh Ah = 4dh Al = return code ah = end method 2.0 call function 4 ch can only be called once
── ─
Obtain PSP address 62 h Ah = 62 h BX = PSP address 3.0
── ─
2. Standard Input/Output Functions
── ─
Input 01 H Ah = 01 h Al = 8 characters 1.0
Do not bring back the explicit direct Character Input 07 h Ah = 07 h Al = 8-character 1.0
Do not bring back the explicit characters. Enter 08 h Ah = 08 h Al = 8-character 1.0
Keyboard Buffer input 0ah Ah = 0ah DS: DX → input buffer segment: displacement
Buffer Zone storage keyboard input character 1.0 input buffer format
── ─
Check the keyboard status 0bh Ah = 0bh if any character is input: Al = FFH; if no character is input: Al = 00 h 1.0
── ─
Refresh the Keyboard Buffer. Read the keyboard 0ch Ah = 0ch Al = function number (01 H, 06 h, 07 h, 08 h, or 0ah) depends on the function 1.0 specified in Al.
── ─
Character output 02 h Ah = 02 h DL = 8-character 1.0
── ─
String output 09 h Ah = 09 h DS: DX → end string data segment: displacement 1.0
── ─
3. Console I/O Control
── ─
Direct Character Input/Output 06 h Ah = 06h input 1 character: DL = FFH output 1 character:
DL = 8 characters (00h_feh) If DL = FFH is used, then: Al = 8 characters 1.0
── ─
4. Various I/O controls
── ─
Auxiliary input 03 h Ah = 03 h Al = 8-character 1.0
Auxiliary output 04 H Ah = 04 h dl = character 1.0
Printer output 05 h Ah = 05 h 1.0
DL = character
── ─
5. Disk Functions
── ─
Refresh disk buffer 0dh Ah = 0dh 1.0 see function 68 h
── ─
Select disk drive 0eh Ah = 0eh DL = drive Id Al = system drive letter
1.0 for dos3.0 and later versions, Al> = 05 h
── ─
Obtains the current magnetic field.
Disk No. 19 h Ah = 19 h Al = drive ID 1.0
── ─
Set the DTA address 1ah Ah = 1ah DS: DX → DTA segment: displacement 1.0
── ─
Take the default drive information ibh Ah = 1bh Al = number of sectors contained in each cluster
Cx = number of bytes per sector dx = Total number of disks
DS: BX → fat mark byte segment: displacement
1.0 expired, replaced by 36 h
── ─
Obtains the specified drive information.
Ich Ah = 1ch DL = drive sign Al = number of sectors contained in each cluster Cx = number of bytes contained in each sector dx = Total number of clusters on the disk
DS: BX → the media flag byte has expired and is replaced by the function 1.0 36 h
── ─
Set verification flag 2EH Ah = 2EH Al = flag value (0 = OFF, 1 = on) dL = 00 h 1.0 dos 3.0 versions earlier than DL = 00h call
── ─
Take the DTA address 2fh Ah = 2fh ES: BX → DTA 2.0
── ─
Take the disk free space 36 h Ah = 36 h DL = drive ID if the drive ID is incorrect:
Ax = ffffh; if there is no error: AX = number of sectors contained in each cluster BX = number of unused clusters Cx = number of bytes contained in each sector dx = Total number of disks 2.0
── ─
Verify mark 54 h Ah = 54 h Al = mark value (0 = OFF, 1 = 9n) 2.0
── ─
6. File Management
── ─
Delete file 13 H Ah = 13hds: DX → FCB if there is an error: Al = FFH, if there is no error:
Al = 00 h 1.0 expired, replaced by 41h
── ─
Create File 16 h Ah = 16 h DS: DX → FCB segment: if the displacement is wrong: Al = FFH;
If no error occurs: Al = 00 h 1.0 is out of date, use the 3ch5ah or 5bh function.
── ─
Modify file 17 h Ah = 17hds: DX → modified FCB segment: displacement
If there is an error: Al = FFH; if there is no error: Al = 00 h 1.0 is out of date, use the function 56h instead.
── ─
Take the file size 23 h Ah = 23hds: DX → FCB segment: if the displacement is wrong: Al = FFH;
If there is no error: Al = 00 h FCB contains file size information 1.0 out of date, replace it with the function 42h
── ─
Analysis file name 29 H Ah = 29 H Al = control bit DS: Si → segment of the analyzed string: displacement
ES: di → FCB segment: displacement Al = Error Code DS: Si → segment of the last field of the analyzed string: displacement ES: di → FCB segment: displacement 1.0 cannot be analyzed
── ─
Create File 3ch Ah = 3ch Cx = attribute DS: DX → asciiz file description table section: if the displacement is incorrect: Set CF, Ax = Error Code; if no error occurs:
Clear cf ax = file handle 2.0
── ─
Delete file 41 h Ah = 41 h DS: DX → axciiz file Description: Table segment: displacement
If there is a mistake: Set CF, Ax = Error Code; if there is no error: Clear CF 2.0
── ─
Set/retrieve file attributes 43 H Ah = 43 h ds: DX → asciiz file description table section: displacement File Retrieval attributes: Al = 00 h set file attributes: al = 01 h ch = if the attribute is incorrect: Set CF, Ax = Error Code; if no error occurs: Clear CF, Cx = attribute (such as when calling Al = 00 h) 2.0
── ─
Modify the file name 56 h Ah = 56 h DS: DX → original asciia file description table segment: displacement
ES: di → description of the table segment in the new asciiz file: displacement
If there is an error: Set CF, Ax = if there is no error: Clear cf
2.0 can be used to move a file from one directory to another
── ─
Set/retrieve file date and time 57 H Ah = 57 h bx = file handle fetch Date and Time: Al = 00h set date and time: al = 01 H Cx = Time dx = period if there is an error: Set CF, Ax = Error Code; if there is no error: Clear CF; if the call time is Al = 00 h, then: cx = date dx = period 2.0
── ─
Create a temporary file 5ah Ah = 5ah Cx = attribute DX: DX → add 13 NULL bytes to the asciiz path section: if the displacement is wrong: Set CF, Ax = Error Code; if no error occurs: clear CF, Ax = file handle DS: DX → asciiz file description table section: displacement 3.0
── ─
Create a new file 5bh Ah = 5bh Cx = attribute DS: DX → asciiz file description table segment: Bit shifting if wrong: Set CF, Ax = Error Code; clear CF if no error occurs, ax = file handle 3.0
── ─
7. file input/output
── ─
Open the file 0fh Ah = 0fh DS: DX → FCB segment: Shift Al = return code 1.0 has passed, use the function 3DH instead
── ─
Close file 10 h Ah = 10 h DS: DX → FCB segment: displacement Al = return code
Use Function 3eh instead
── ─
Sequential read 14 h Ah = 14 h DS: DX → FCB segment: displacement Al = return code DTA contains read data 1.0 out of date, use the function 3fh to write 15 h Ah = 15 h DS: DX → FCB segment: displacement DTA containing data to be written
Al = the return code 1.0 is out of date and is replaced by the 40 h Function
── ─
Random read record 21 h Ah = 21 h DS: DX → FCB segment: displacement Al = return code DTA contains read data 1.0 out of date, replaced by function 3fh
── ─
Random write record 22 h Ah = 22 h DS: DX → FCB segment: displacement DTA containing data to be written
Al = the return code 1.0 is out of date and is replaced by the 40 h Function
Set the PCB random record field 24 h Ah = 24 h DS: DX → FCB segment: displacement Al = 00 h FCB with updated random record field 1.0 out of date, replace with function 42h
── ─
Read random record blocks 27 h Ah = 27 h Cx = number of records DS: DX → FCB segment: displacement
Al = return code Cx = number of records read. DTA contains read data 1.0 out of date, replaced by function 3fh
── ─
Write random record Block 28 h Ah = 28 h Cx = number of records DS: DX → FCB segment: displacement DTA containing data to be written Al = return code Cx = number of written records 1.0 out of date, replaced by function 40 h
── ─
Open the file handle 3DH Ah = 3DH Al = File Access Code DS: DX → asciiz file description table section: if the displacement is incorrect: Set CF, Ax = Error Code; if no error occurs: Clear CF, ax = file handle 2.0 close file handle 3eh Ah = 3eh BX = file handle if there is an error: Set cf ax = Error code: If there is no error: Clear CF 2.0
── ─
Read from a file or device 3fh Ah = 3fh BX = file handle Cx = number of bytes to read DS: DX → buffer segment: if the displacement is wrong: Set CF bit AX = Error code; if no error occurs, clear cf ax = number of bytes read. DS: DX → buffer segment: displacement: 2.0
── ─
Write 40 h Ah = 40 h BX = file handle Cx = number of bytes to write to a file or device DS: DX → buffer segment: if there is a displacement error: Set cf ax = Error code: if no error occurs: Clear cf ax = 2.0 bytes written
── ─
Move the file pointer 42 h Ah = 42 h BX = file handle CX: dx = move the pointer offset to the start position of the file: Al = 00h move to the current position: al = 01h move to the end of the file: Al = 02 h if there is a mistake: Set cf ax = Error Code; if there is no error: Clear cf dx: AX = new file pointer segment: displacement 2.0
── ─
Copy file handle 45 h Ah = 45 h BX = file handle if there is an error: Set cf ax = Error Code; if not, clear cfax = new file handle 2.0
── ─
Forced copy file handle 46 h Ah = 46 h BX = file handle Cx = copied file handle if there is a mistake: Set cf ax = return code; if there is no error: Clear CF 3.0
── ─
Block/unlock file area 5ch Ah = 5ch BX = file handle CX: dx = the first address segment of the file area to be blocked/unlocked: displacement Si: di = block/unlock file area size to block file area: Al = 00h to open file area: Al = 01 H if there is a mistake: Set cf ax = Error code: if there is no error: Clear CF 3.0 and share are used together or in the Network Environment
── ─
Set the handle counter 67 h Ah = 67 h BX = number of file handles. If there is an error: Set cf ax = Error code: If there is no error: Clear CF 3.3
── ─
Submit the file 68 h Ah = 68 h BX = if the file handle is incorrect: Set CF, Ax = Error Code; if no error occurs: Clear CF 3.3
── ─
8. Directory Function
── ─
Search for the first matched directory entry 11 h Ah = 11 h DS: DX → FCB segment: if the displacement is incorrect: Al = FFH; if no error exists: al = 00 h DTA containing directory information 1.0 expired, replaced by function 4eh
── ─
Search for the next matched Directory Entry 12 h Ah = 12 h DS: DX → FCB segment: if the displacement is incorrect: Al = FFH; if no error exists: al = 00 h DTA containing directory information 1.0 expired, replaced by function 4fh
── ─
Create directory 39 h Ah = 39 h DS: DX → asciiz path section: if the displacement is incorrect: Set cf ax = Error Code; if no error is found: Clear CF 2.0
── ─
Delete the 3ah Ah = 3ah DS: DX → asciiz path section: if the displacement is incorrect: Set cf ax = Error code: If no error is found: Clear CF 2.0
── ─
Take the current directory 47 h Ah = 47 h DL = drive id ds: Si → segment of the 64-byte empty Buffer: if the displacement is incorrect: Set cf ax = Error Code; if no error occurs: clear cf ds: Si → asciiz path segment: displacement 2.0
── ─
Search for the first matched directory entry. The 4eh Ah = 4eh Cx = attribute DS: DX → asciiz file indicates the table segment: if the displacement is incorrect: Set cf ax = Error Code; if no error occurs: clear cf dta directory information 2.0
── ─
Search for the next matched directory entry 4fh Ah = 4fh DT containing the information obtained from the previous call 4eh or 4fh. If there is an error: Set cf ax = Error Code; if there is no error: clear cf dta directory information 2.0
── ─
9. date/time functions
── ─
Date 2ah Ah = 2ah Al = day of the week Cx = year DH = month DL = day 1.0
── ─
Set date 2bh Ah = 2bh Cx = year DH = month DL = day if there is an error: Al = FFH; if there is no error: Al = 00 h 1.0
── ─
2ch Ah = 2ch CH = hour Cl = minute DH = Second DL = 1/100 seconds
── ─
Set Time 2dh Ah = 2dh CH = hour Cl = minute DH = Second DL = 1/100 second if there is an error: Al = FFH if there is no error: Al = 00 h 1.0
── ─
10. Other functions
── ─
Set the interrupt vector 25 h Ah = 25 h Al = the interrupt number DS: DX → specify the segment address of the interrupt vector 1.0
── ─
Take the DOS version number 30 h Ah = 30 h Ah = auxiliary version number Al = main version number BX, Cx = continuous number 2.0dos version 1.0 return Al = 00hos/compatible register return Al = 0ah
── ─
Take the interrupt vector 35hah = 35 h Al = interrupt number ES: BX = content of the specified interrupt vector 1.0
── ─
Set/retrieve information related to the specified country 38 H Ah = 38 h Al = Country Code or ffh bx = Country Code (if Al = FFH); obtain country information: DS: DX → 34-byte long empty buffer segment: Shift country information: dx = ffffh if there is a mistake: Set CF bit AX = Error Code; if there is no error: Clear CF bit; if DX <> ffffh is used: BX = Country Code DS: DX → country information 2.0dx = ffffh and Al = FFH are called only for support of dos3.0 and later versions. See function 65 h.
── ─
IOCTL 44 h Ah = 44 h Al = sub-function number (the remaining register value depends on the sub-function number) if there is a mistake: Set CF bit AX = Error Code; if there is no error: clear the CF bit (the remaining register values depend on the sub-function number)
── ─
Retrieve expanded error message 59 h Ah = 59 h BX = 00 h AX = extended error code bH = Error Type BL = suggested action CH = error location 3.0 change Cl, dx, Si, di, es, and DS values
── ─
For Network machine names and printers, set 5eh Ah = 5eh Al = sub-function number (the value of other registers depends on sub-function). If there is an error: Set CF bit AX = Error code: If no error occurs: clear CF bit (the value of other registers depends on the sub-function number) 3.1 only applies to the Network Environment
── ─
Network redirection 5fh Ah = 5fh Al = sub-function number (the remaining register value depends on the sub-function number) if the error is: Set CF bit AX = Error Code; if no error occurs: clear CF bit (other register values are determined by sub-function number) 3.1 only applies to network environments
── ─
65 h Ah = 65 h Al = info ID code BX = code page number CX = buffer length dx = Country ID code ES: di → Buffer Zone Segment: if the displacement is wrong: Set CF bit AX = Error Code; if there is no error: Clear CF bit ES: di → expanded country information section: displacement 3.3
── ─
Set/retrieve the global code page 66 h Ah = 66h to retrieve the current code page: Al = 01h to set the current code page: Al = 02 h BX = code page number if there is an error: set CF bit AX = error code. If no error occurs: Clear CF bit; if called with Al = 01h, then: BX = current code page dx = default code page 3.3
── ─
11. memory functions
── ─
Allocate memory block 48 h Ah = 48 h BX = block size if the block size is incorrect: Set CF bit AX = Error Code BX = maximum capacity of the available block; if no error occurs: clear CF bit AX = allocated Block Segment address 2.0
── ─
Release memory block 49 H Ah = 49 H es = address of memory block segment if wrong: Set CF bit AX = Error
Error Code. If no error occurs, clear the CF bit 2.0
── ─
Change memory block size 4ah Ah = 4ah BX = new value of memory block size in the segment es = segment address of memory block if there is an error: set CF bit AX = Error Code BX = maximum available block capacity (if you need to increase the capacity); if no error occurs: Clear CF bit 2.0
── ─
Set/fetch memory allocation policy 58 h Ah = 58h fetch Memory Allocation Policy: Al = 00h set the deposit allocation policy: Al = 01 h bx = policy code if there are errors: set CF bit AX = Error Code; if no error occurs: Clear CF bit; if Al = 00 H is called, then: AX = policy code 3.0
When there are too many other users, there are too many other users, too many other users.