Assembly Int21h,dos Call

Source: Internet
Author: User

Table: DOS system function tuning int 21H
The AH function call parameter returns the parameter
00 program termination (same as int 20H) cs= program segment Prefix
01 keyboard input and echo al= input characters
02 Display output dl= output characters
03 Asynchronous communication input Al= input data
04 Asynchronous communication output dl= output data
05 Printer output dl= output character
06 Direct Console I/O dl=ff (Input)
dl= character (output) al= input character
07 keyboard input (no echo) al= input characters
08 Keyboard input (no echo)
Detecting Ctrl-break al= Input characters
09 Displaying strings ds:dx= string addresses
' $ ' End string
0A keyboard input to buffer ds:dx= buffer first address
(DS:DX) = maximum number of characters in buffer (ds:dx+1) = number of characters actually entered
0B Verify keyboard status al=00 has input
AL=FF No input
0C clears the input buffer and
Request the specified input function al= input function number
(1,6,7,8,a)
0D disk reset purge file buffers
0E Specifies the current default disk drive dl= drive letter 0=a,1=b,... Number of al= drives
0F Open File DS:DX=FCB first address al=00 file found
AL=FF File not found
10 Close file DS:DX=FCB first address al=00 directory modified successfully
File not found in Al=ff directory
11 Find First directory entry DS:DX=FCB first address al=00 found
Al=ff not found
12 Find Next Directory entry DS:DX=FCB first address
(file with * or?) Al=00 found
Al=ff not found
13 Delete file DS:DX=FCB First address al=00 Delete succeeded
Al=ff not found
14

Sequential read

DS:DX=FCB First Address

AL=00 Read Success
= 01 end of file, no data in record
=02 DTA space is not enough
= 03 end of file, incomplete record
15 Sequential write DS:DX=FCB first address al=00 write success
=01 full
=02 DTA space is not enough
16 built file DS:DX=FCB first address al=00 established successfully
=FF No disk space
17 File name DS:DX=FCB first address
(ds:dx+1) = old file name
(ds:dx+17) = new file name al=00 successful
Al=ff not successful
19 take the current default disk drive al= the default drive letter 0=a,1=b,2=c,...
1 A DTA address DS:DX=DTA address
1 b

Take the default drive fat information

Al= number of sectors per cluster
Ds:bx=fat Identity Byte
cx= Physical Sector size
dx= the number of clusters for the default drive
1C take any drive fat information dl= drive letter ibid.
21st

Random Read

DS:DX=FCB First Address

AL=00 Read Success
= 01 End of File
=02 Buffer Overflow
=03 Buffer Dissatisfaction
22 Random Write DS:DX=FCB first address al=00 write success
=01 full
=02 Buffer Overflow
23 Determining File Size DS:DX=FCB First address al=00 success (file length fill in FCB)
Al=ff not found
24 set random record number DS:DX=FCB first address
25 Set interrupt vector ds:dx= interrupt vector
Al= Interrupt Class Model
26 Creating a program segment prefix dx= new program segment prefix
27

Random block Reading

DS:DX=FCB First Address
cx= Record Count al=00 read success
= 01 End of File
=02 buffer too small, transfer end
=03 Buffer Dissatisfaction
28 Random chunked Write DS:DX=FCB first address
cx= Record Count al=00 write success
=01 full
=02 Buffer Overflow
29 Parse file name ES:DI=FCB first address
Ds:si=asciiz string
al= control Analysis Flag al=00 standard file
= 01 Multi-semantic files
=02 Illegal drive letter
2 a take date cx= year
Dh:dl= Month: day (binary)
2 B Set Date cx:dh:dl=: Month: Day al=00 success
=FF invalid
2 c Take time ch:cl=: minutes
Dh:dl= seconds: 1/100 seconds
Set time ch:cl=: Min
Dh:dl= seconds: 1/100 seconds al=00 Success
=FF invalid
2E disk Automatic read-write flag al=00 off flag
AL=01 Open Flag
2F fetch the first address of the disk buffer es:bx= buffer first address
30 Take DOS version number ah= release number, al= version
31 end and reside al= return code
dx= Dwell Area Size
33

Ctrl-break detection

al=00 Take status
=01 status (DL)
Dl=00 off detection
=01 Open detection dl=00 off Ctrl-break detection
=01 Open Ctrl-break Detection
35 take interrupt Vector al= interrupt type es:bx= interrupt vector
36


Take free disk space


Dl= Drive Letter
0= default, 1=a,2=b,...

Success: Number of sectors per cluster ax=
bx= number of active clusters
cx= number of bytes per sector
dx= total number of clusters
Failure: AX=FFFF
38 Place/Fetch national information ds:dx= first address bx= Country code (international telephone prefix code)
ax= error code
39 Creating a subdirectory (MKDIR) Ds:dx=asciiz string address ax= error code
3 a Delete subdirectory (RMDIR) Ds:dx=asciiz string address ax= error code
3 b Change current directory (CHDIR) Ds:dx=asciiz string address ax= error code
3C Create file Ds:dx=asciiz string address
cx= file attribute succeeded: ax= file code
Error: ax= error code
3D

Open File

Ds:dx=asciiz string Address
Al=0 Read
=1 Write
=3 Read/write success: ax= file code
Error: ax= error code
3E closing file bx= file code failure: ax= error code
3F

Read a file or device

ds:dx= Data Buffer Address
bx= File Code
Cx= read the number of bytes read successfully:
ax= number of bytes actually read in
Ax=0 to end of file
Read error: ax= error code
40 Write file or device ds:dx= data buffer address
bx= File Code
Cx= writes the number of bytes written successfully:
ax= the number of bytes actually written
Write error: ax= error code
41 Delete File Ds:dx=asciiz string address success: ax=00
Error: ax= error code (2,5)
42


Move file pointer


bx= File Code
cx:dx= Displacement Amount
Al= Move mode (0: Absolute shift from File header, 1: Relative move from current position, 2: absolute shift from end of file) success: dx:ax= new file pointer position
Error: ax= error code


43

Place/Fetch file properties

Ds:dx=asciiz string Address
al=0 fetching file attributes
Al=1 file Properties
Cx= File Property succeeded: cx= file property
Failure: cx= error code
44




Device file I/O control




bx= File Code
Al=0 Take status
=1 Status DX
=2 reading data
=3 Writing data
=6 Take input status
=7 fetching output Status dx= device information





45 Copy file Code bx= file code 1 success: ax= file code 2
Failure: ax= error code
46 Manual Copy file code bx= file code 1
cx= File Code 2 failed: ax= error code
47 take the current directory pathname dl= drive letter
Ds:si=asciiz string Address (ds:si) =asciiz string
Failure: ax= error code
48 Allocating memory space bx= request memory capacity success: ax= allocating memory first place
Failure: bx= Maximum available memory
49 Free content Space es= memory start segment address failed: ax= error code
4A Adjust allocated storage Block es= original memory start address
Bx= re-requested capacity failed: bx= Maximum free space
ax= error code
4 b

Assembly/Execution Procedures

Ds:dx=asciiz string Address
Es:bx= the first address of the parameter area
Al=0 Loading execution
al=3 mount no execution failure: ax= error code


4C with return code end al= return code
4D fetch return code ax= return code
4E find first matching file Ds:dx=asciiz string address
cx= Property ax= error code (02,18)
4F Find Next matching file Ds:dx=asciiz string address
(file name with the? or *) Ax= error code (18)
54 Fetch Disk Automatic read-write flag al= Current flag value
56 File Renaming Ds:dx=asciiz string (old)
Es:di=asciiz string (new) ax= error code (03,05,17)
57 Place/Fetch file date and time bx= file code
Al=0 Read
Al=1 Set (DX:CX) dx:cx= Date and time
Failure: ax= error code
58 Pick/Place allocation policy code al=0 fetch code
Al=1 Code (BX) Success: ax= Strategy code
Failure: ax= error code
59

Fetch extension Error code

Ax= Expansion Error code
Bh= Error Type
Bl= Recommended Actions
Ch= wrong place
5A Creating temporary files cx= file properties
Ds:dx=asciiz string Address success: ax= file code
Failure: ax= error code
5B creating a new file Cx= file properties
Ds:dx=asciiz string Address success: ax= file code
Failure: ax= error code
5C


Controlling file access


al=00 blockade
=01 Open
bx= File Code
cx:dx= File Displacement
si:di= file length failed: ax= error code



62 Fetch Program Segment prefix BX=PSP address

Assembly Int21h,dos Call (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.