Compile File Operations

Source: Internet
Author: User
File Operation Function)

3CH- Create a file
3DH- Open a file
3EH- Close file
41 H- Delete an object
43 H- Read/set file attributes
45 H- Copy file handle
46 H- Redefinition file handle
4EH- Find the first file
4FH- Find the next file
56 H- File Name Change

(1) function 3CH

  Function Description: Create 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)

Bit 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 details, see error code table.

(2) function 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. The 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
Bits 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 details, 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) 41 H Functions

  Function Description: Deletes a specified object.
Entry parameters: AH = 41 H
DS: dx = address of the file name string
Exit parameters: Cf = 0 -- the deletion is successful. Otherwise, Ax = Error Code (02 h, 03h or 05 h). For details, see error code table.

(5) 43 H Functions

  Function Description: Reads or sets 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
Bit 5 = 1 -- Archive Do not retain other bits, and set them to 0.
Exit parameters: Cf = 0 -- close successful, Cx = File Attribute. Otherwise, Ax = Error Code (01 H, 02 h, 03h or 05 h). For details, see error code table.

(6) 45 H Functions

  Function Description: Copy the current handle that opens a device or file. The handle corresponds to the same location of the 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 (H or 06 h). For details, 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 succeeded. Otherwise, Ax = Error Code (H or 06 h). For details, see error code table.

(8) function 4EH

  Function Description: Obtain the first file that matches the specified 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) enter data as follows:

Byte 00 ~ 14 h Retained
15 h in bytes Matching file attributes
Byte 16 ~ 17 h Compressed file name
Byte 18 ~ 19 h Compressed file date
Byte 1A ~ 1dh File Size
Bytes 1E ~ 2ah File Name string

(9) function 4FH

  Function Description: After the 21h function is interrupted and 4eh is used successfully, search for the next file name.
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 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 -- the operation is successful. Otherwise, the ax = Error Code (02 h, 03 h, 05 h, and 11 h) can be found in the error code table.

(11) function 57 H

  Function Description: Read/set file date and time
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 its meaning, see error code table. Otherwise, if the file information is read, CX = Time, DX = Date

(12) function 5AH

  Function Description: Create temporary files
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: Create 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 4 = 0 Retained
Bit 1 = 1 Implicit Bit 5 = 1 Archive
Bit 2 = 1 System 6-15 = 0 Retained
Bit 3 = 1 Volume label
Exit parameters: CF = 0 -- operation succeeded. AX = file handle. Otherwise, AX = Error Code (03 H, 04 H, 05H, or 50 H). For details, see error code table.

(14) 67 H Functions

  Function Description: Set the number of file handles (maximum number of files)
Entry parameters: AH = 67 H
BX = number of handles
Exit parameters: CF = 0 -- operation succeeded; 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-write denied
011-read 100 denied-no operation is denied
Bits 7 0-the sub-process inherits the handle; 1-The sub-process does not inherit the handle.
12-bit ~ 8 Reserved (0)
Bit 13 Fatal error handler, 0-Execute int 24 h; otherwise, the error code is returned to the Process
Bit 14 Write method: 0-write buffer, 1-write files directly
Digit 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-open failed, 1-open file, 2-replace File
Bits 7 ~ 4 0-open failed, 1-Create 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.

 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? PostId = 1433728

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.