[Reprint] dos interrupt int 21 h Daquan

Source: Internet
Author: User

Character Function

01 H, 07h, and 08 h-input characters from the Standard Device

02 h-character output

03 h-auxiliary device input

04 H-output of auxiliary devices

05 h-Print Output

06 h-console input/output

09 h-display string

0ah-Keyboard Buffer Input

0bh-check input status

0ch-clear input buffer input function

1. Functions: 01 H, 07h, and 08 h

Function Description: reads a character from a standard input device (for example, a keyboard. The interrupt will remain in the waiting state during the processing until the characters are readable. This input can also be redirected. If so, you cannot determine whether the file is at the end of the file.

Entry parameters:

Ah = 01 H, filter out control characters, and echo.

Ah = 07 h, but the control characters are filtered out without echo.

Ah = 08 h. filter out control characters without echo.

Exit parameters:

Al = ASCII code of the input character.

2. Function 02 h

Function Description: outputs a character to a standard output device (for example, a screen. The output can also be redirected. If you do so, you cannot determine whether the disk is full.

Entry parameters:

Ah = 02 h

DL = ASCII code of the characters to be output

Exit parameter: None

3. Functions 03 h

Function Description: reads a character from a secondary device. The default value of this secondary device is COM1.

Entry parameters:

Ah = 03 h

Exit parameters:

Al = ASCII code for reading characters

4. Function 04 H

Function Description: outputs a character to the auxiliary device. The default value of this auxiliary device is COM1.

Entry parameters:

Ah = 04 H

DL = ASCII code of the characters to be output

Exit parameter: None

5. Function 05 h

Function Description: outputs a character to the standard output device. The default output device is a printer with the LPT1 port, unless changed using the mode command.

Entry parameters:

Ah = 05 h

DL = ASCII code of the characters to be output

Exit parameter: None

6. Functions 06 h

Function Description: Console (for example, keyboard or screen) input/output. If the input/output operations are redirected, you cannot determine whether the file is at the end of the file or whether the disk is full.

Entry parameters:

Ah = 06 h, DL = input/output function Selection

Exit parameters:

If DL = 00h-feh, this function is output, and DL is the ASCII code of the characters to be output;

If DL = 0ffh, this function is input. At this time, if ZF = 1, no characters are readable. Otherwise, Al = the ASCII code of the characters to be read.

7. Features 09 h

Function Description: outputs a string to the standard output device. If the output operation is redirected, the disk is full.

Entry parameter: Ah = 09 h

DS: dx = address of the character to be output

Description: The string to be displayed uses '$' as its end sign.

Exit parameter: None

8. Function 0ah

Function Description: reads a byte string from the standard input device and ends the input with the "Enter key" (the input character is displayed on the standard output device ). If the input operation is redirected, you cannot determine whether the file is at the end of the file.

Entry parameters:

Ah = 0ah

DS: dx = start address for storing input characters

Description of input string buffer accepted:

1. The first byte is the maximum buffer capacity, which can be considered as an entry parameter;

2. The second byte is the number of characters actually entered (excluding the Enter key), which can be considered as an exit parameter;

3. stores the actual input string starting from the third byte;

4. The string ends with the carriage return key. The carriage return is the last accepted character;

5. If the number of characters entered exceeds the maximum buffer capacity, the excess will be discarded and the system will send a bell until you enter the "Press ENTER" key to end the input.

For example:

Buff 80 ,?, 80 DUP (?) ; Up to 80 characters allowed

Exit parameter: None

9. Function 0bh

Function Description: checks whether characters are readable on the standard input device. This input operation can be redirected

Entry parameters:

Ah = 0bh

Exit parameters:

Al = 00 h -- no characters are readable;

FFH -- character readable

10. Functions 0ch

Function Description: clears the current standard input buffer and then reads characters. Its input operations can be redirected.

Entry parameters:

Ah = 0ch

Al = 01 H, 06 h, 07 h, 08h, or 0ah

Exit parameters:

If the entry parameter Al is 0ah, DS: dx = stores the start address of the input character. Otherwise, the exit parameter Al = ASCII code of the input character
 
Directory Control

39 h-create a directory

3ah-delete directory

3bh-set the current directory

47 h-read the current directory

1. 39 h Functions

Function Description: Creates a new directory with the specified drive and path.

Entry parameters:

Ah = 39 h

DS: dx = string address of the specified path (0 is the end mark of the string)

Exit parameters:

Cf = 0 -- created successfully. Otherwise, Ax = Error Code (H or 05 h). For more information, see error code table.

2. Functions 3ah

Function Description: Delete the directory of the specified drive and path.

Entry parameters:

Ah = 3ah

DS: dx = string address of the specified path (0 is the end mark of the string)

Exit parameters:

Cf = 0 -- deletion successful; otherwise,

Ax = Error Code (03h or 05 h). For more information, see error code table.

3. Functions 3bh

Function Description: Set the specified drive and path to the current directory.

Entry parameters:

Ah = 3bh

DS: dx = string address of the specified path (0 is the end mark of the string)

Exit parameters:

Cf = 0 -- the setting is successful. Otherwise, Ax = Error Code (03 h). For more information, see error code table.

4. Functions 47 h

Function Description: obtains the full path string of the current directory.

Entry parameters:

Ah = 47 h

DL = drive letter (0 = default, 1 = ,...)

DS: SI = address for storing the string of the current directory

Exit parameters:

Cf = 0 -- the read is successful. Otherwise,

Ax = Error Code (0fh). For more information, see error code table.
 
Disk Management

0dh-disk Reset

0eh-select Disk

19 h-read the current drive

1bh, 1ch-read drive data

2EH-set verification flag

36 h-read drive allocation information

54 h-read verification mark

1. Function 0dh

Function Description: clears the current File Buffer, but in the MS-DOS, data temporarily written to the buffer is written to the disk

Entry parameters:

Ah = 0dh

Exit parameter: None

2. Function 0eh

Function Description: Specifies the current drive.

Entry parameters:

Ah = 0eh

DL = drive letter (0 = A, 1 = B ,...)

Exit parameters:

Al = current drive letter in the system

3. features 19 h

Function Description: obtains the current default drive letter.

Entry parameters:

Ah = 19 h

Exit parameters:

Al = drive letter (0 = A, 1 = B ,...)

4. Functions: 1bh and 1ch

Function Description: obtains the drive allocation information.

Entry parameters:

Ah = 1bh -- default drive

Ah = 1ch -- any drive,

DL = drive letter (0 = default, 1 = ,...)

Exit parameters:

Al = 0ffh -- failed,

Otherwise,

Al = number of sectors per cluster

DS: BX = ID byte address

Cx = physical sector size (bytes)

DX = number of drives

5. Function 2EH

Function Description: sets/clears the operating system's automatic read inspection mark.

Entry parameters:

Ah = 2EH

DL = 00 h

Al = 00 h -- clear this flag, 01 H -- set this flag

Exit parameter: None

6. 36 h Functions

Function Description: obtains information about the selected drive.

Entry parameters:

Ah = 36 h

DL = drive letter (0-default, 1 = A, 2 = B ,...)

Exit parameters:

If the function call fails, Ax = 0 ffffh; otherwise,

Ax = number of sectors per cluster

BX = number of available Clusters

Cx = physical sector size (bytes)

DX = number of clusters in the drive

7. Functions 54 h

Function Description: Read verification mark

Entry parameters:

Ah = 54 h

Exit parameters:

Al = Current Inspection flag value:

00 h-off inspection,

01 H-open test
 

3ch-create a file

3DH-open a file

3eh-close the file

41 h-delete an object

43 H-Read/set file attributes

45 h-copy file handle

46 h-redefinition of file handle

4eh-find the first file

4fh-find the next file

56 h-file name change

57 H-Read/set the date and time of the file

5ah-create temporary files

5bh-create new file

67 h-set the number of file handles (maximum number of files)

6ch-extended file opening function (opening, creating, or replacing files)

1. Function 3ch

Function Description: Creates a new file with the specified file name. If the specified file already exists, set the length to 0. After the file is created, it is opened and its handle is returned.

Entry parameters:

Ah = 3ch

DS: dx = specifies the address of the file name string (0 is the end mark of the string)

Cx = file attributes (these flags can be combined) 0 = 1 -- read-only

Bit 2 = 1 -- System

Bit 5 = 1 -- Archive

Bit 1 = 1 -- implicit

Bit 3 = 1 -- volume label

Do not retain other bits, and set them to 0.

Exit parameters:

Cf = 0 -- created successfully, Ax = file handle,

Otherwise, Ax = Error Code (03 h, 04h or 05 h). For more information, see error code table.

2. Functions 3DH

Function Description: Open the specified drive, path, and file name, and return the file handle.

Entry parameters:

Ah = 3DH

DS: dx = indicates the string of the file (0 is the end mark of the string)

Al is the open method:

Bit 0 ~ 2

000-read-only mode

001-write mode

010-read/write mode

Bit 3 reserved, its value is 0

4-digit ~ 6. Sharing Mode

000-compatibility mode

001-do not share

010-write rejected

011-read denied

100-do not reject any operation

Bit 7 inheritance flag -- 0/1: the sub-process inherits or does not inherit the handle

Exit parameters:

Cf = 0 -- open successfully, Ax = file handle,

Otherwise, Ax = Error Code (02 h, 03 h, 04 H, 05h, or 0ch). For more information, see error code table.

3. Function 3eh

Function Description: Close the file with the specified handle.

Entry parameters:

Ah = 3eh

BX = file handle

Exit parameters:

Cf = 0 -- close successful,

Otherwise, Ax = Error Code (06 h). For more information, see error code table.

4. Features 41 h

Function Description: deletes a specified object.

Entry parameters:

Ah = 41 h

DS: dx = address of the file name string

Exit parameters:

Cf = 0 -- deletion successful,

Otherwise, Ax = Error Code (02 h, 03h or 05 h). For more information, see error code table.

5. 43 H Functions

Function Description: read or set attributes of a specified object.

Entry parameters:

Ah = 43 H

BX = file handle

DS: dx = address of the file name string

Al = 00 h/01 H -- Read/set file attributes

Cx = file attributes:

Bit 0 = 1 -- read-only

Bit 1 = 1 -- implicit

Bit 2 = 1 -- System

Bit 3 = 1 -- volume label

Bits 5 = 1 -- Archive other bits are not used and set to 0

Exit parameters:

Cf = 0 -- close successful, Cx = file property,

Otherwise, Ax = Error Code (01 H, 02 h, 03h or 05 h). For more information, see error code table.

6. functions 45 h

Function Description: copy the handle of the currently opened device or file, which corresponds to the same location of the same device or file

Entry parameters:

Ah = 45 h

BX = file handle to be copied

Exit parameters:

Cf = 0 -- copied successfully, Ax = new handle,

Otherwise, Ax = Error Code (04h or 06 h). For more information, see error code table.

7. 46 h Functions

Function Description: specify two handles and direct the second handle to the first handle, that is, the second handle is redirected.

Entry parameters:

Ah = 46 h

BX = file or device handle

Cx = file handle to be redirected

Exit parameters:

Cf = 0 -- redirection successful,

Otherwise, Ax = Error Code (04h or 06 h). For more information, see error code table.

8. Function 4eh

Function Description: gets the first file that matches the given file name.

Entry parameters:

Ah = 4eh

DS: dx = string of the given file name

Cx = file attributes used for search:

Bit 0 = 1 -- read-only

Bit 1 = 1 -- implicit

Bit 2 = 1 -- System

Bit 3 = 1 -- volume label

Bit 4 = 1 -- directory

Bit 5 = 1 -- Archive

Do not retain other bits, and set them to 0.

Exit parameters:

Cf = 1 -- operation failed, Ax = Error Code (02 h, 03h or 12 h). For details, see error code table,

Otherwise, the operation is successful, DTA (Disk Transfer

Area) Fill in the data as follows: 00 ~ bytes ~ 14 h Reserved

File Attributes matching 15 h in bytes

Byte 16 ~ 17 h compressed file name

Byte 18 ~ Files compressed in 19h

Byte 1A ~ 1dh File Size

Bytes 1E ~ 2ah file name string

9. Function 4fh

Function Description: searches for the next file name after the 21h function 4eh is interrupted.

Entry parameters:

Ah = 4fh

Al = Returned Code

Exit parameters:

Cf = 1 -- operation failed, Ax = Error Code (12 h). For more information, see error code table,

Otherwise, the operation is successful. The data in the DTA is shown in the previous function 4eh.

10. 56 h Functions

Function Description: file name change

Entry parameters:

Ah = 56 h

DS: dx = string address of the current file name

ES: di = new file name string address

Exit parameters:

Cf = 0 -- operation successful,

Otherwise, Ax = Error Code (02 h, 03 h, 05 h, 11 h). For more information, see error code table.

11. Function 57 H

Function Description: Read/set the date and time of the file.

Entry parameters:

Ah = 57 H

BX = file handle read date and time Al = 00 h

Set date and time Al = 01 H

Cx = Time

(0f ~ 0bh: hour,

0ah ~ 05 h: minute,

04h ~ 00 h: 2 seconds)

DX = Date

(0f ~ 09 h: Year (relative to 1980 ),

08h ~ 05 h: month,

04h ~ 00 h: Day)

Exit parameters:

Cf = 1 -- operation failed,

Ax = Error Code (01 H, 06 h). For more information, see error code table,

Otherwise, if the file is read, Cx = Time, dx = Date

12. Function 5ah

Function Description: creates a temporary file.

Entry parameters:

Ah = 5ah

DS: dx = path name address

Cx = file attributes (bits can be combined), which are defined as follows:

Bit 0 = 1 read-only

Bit 3-4 = 0 Reserved

Bit 1 = 1 implicit

Bit 5 = 1 Archive

Bit 2 = 1 System

6-15 = 0 Reserved

Exit parameters:

Cf = 0 -- operation successful,

Ax = file handle,

DS: dx = complete path file address,

Otherwise, Ax = Error Code (03 h, 04h or 05 h). For more information, see error code table.

13. Function 5bh

Function Description: Creates a new file.

Entry parameters:

Ah = 5bh

DS: dx = path name address

Cx = file attributes (bits can be combined), which are defined as follows:

Bit 0 = 1 read-only

Bit 4 = 0 Reserved

Bit 1 = 1 implicit

Bit 5 = 1 Archive

Bit 2 = 1 System

6-15 = 0 Reserved

Bit 3 = 1 volume label

Exit parameters:

Cf = 0 -- operation successful,

Ax = file handle,

Otherwise, Ax = Error Code (03 h, 04 H, 05h, or 50 h). For more information, see the error code table.

14. Functions 67 h

Function Description: sets the maximum number of file handles)

Entry parameters:

Ah = 67 h

BX = number of handles

Exit parameters:

Cf = 0 -- operation successful,

Otherwise, Ax = Error Code. For more information, see error code table.

15. Function 6ch

Function Description: Extended file opening (opening, creating, or replacing files)

Entry parameters:

Ah = 6ch

Al = 00 h

DS: SI = path name address

BX = open mode

Bits 2 ~ 0

000-read-only

001-write only

010-read and write

Bit 3 Reserved (0)

6-digit ~ 4

000-compatible

001-read/write denied

010 -- refuse to write

011-read denied

100 -- do not reject any operation

Bits 7

0-sub-process inheritance handle,

1-The sub-process does not inherit the handle

12-bit ~ 8 reserved (0)

0-Execute int 24 h. Otherwise, the error code is returned to the process.

Bit 14 write mode:

0-write buffer,

1-directly write files

Bit 15 Reserved (0)

Cx = file attributes

Bit 0 = 1 read-only

Bit 4 = 0 Reserved

Bit 1 = 1 implicit

Bit 5 = 1 Archive

Bit 2 = 1 System

6-15 = 0 Reserved

Bit 3 = 1 volume label

DX = open flag

Bit 3 ~ 0

0-opening failed,

1-open the file,

2-replace files

Bits 7 ~ 4

0-opening failed,

1-create a file

15-bit ~ 8

0-Reserved

Exit parameters:

Cf = 1 -- operation failed, Ax = Error Code. For more information, see error code table. Otherwise,

Ax = file handle

Cx = 1 -- file exists, open it

= 2 -- the file does not exist.
 

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.