INT 21H (0x21)
Function 39H (0x39 or 57) --> Create directory
Call with: AH = 39H
DS: DX = segment: offset of ASCIIZ pathname
Returns: If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function creates a directory using the specified drive and path.
ASCIIZ is known as the sequence of ASCII characters terminated be, Null or Zero, Byte. |
INT 21H (0x21)
Function 3AH (0x3A or 58) --> Delete directory
Call with: AH = 3AH
DS: DX = segment: offset of ASCIIZ pathname
Returns: If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function removes a directory using the specified drive and path. If any element of the pathname does not exist or directory is not empty or access is denied or specified directory is also current directory, the function of deleting the directory fails.
INT 21H (0x21)
Function 3BH (0x3B or 59) --> Set current
directory
Call with: AH = 3BH
DS: DX = segment: offset of ASCIIZ pathname
Returns: If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function sets the current or default directory using the specified drive and path. If the specified path or any element of the path does not exist, the function fails.
INT 21H (0x21)
Function 3CH (0x3C or 60) --> Create file
Call with: AH = 3CH
CX = file attribute, where attribute
significance bits may be Combined.
Significance of bits is given in the
following Table:
Bit(s) |
Significance (if set) |
0 |
Read-only |
1 |
Hidden |
2 |
System |
3 |
Volume label |
4 |
Reserved (0) |
5 |
Archive |
6 – 15 |
Reserved (0) |
DS: DX = segment: offset of ASCIIZ
pathname
Returns: If function successful
Carry flag = clear
AX = handle
If function unsuccessful
Carry flag = set
AX = error code
Comments:
If an ASCIIZ pathname is given, this function creates a new file in the designated or default directory on the designated or default disk drive. If the specified file already exists, it is truncated to zero length. In either case, the file is opened and a handle is returned that can be used by the program for subsequent access to the file.
If any element of the pathname does not exists or file is being created in root directory and root directory is full or access is denied or a file with read – only attribute is already in the specified directory, the function of creating file fails.
INT 21H (0x21)
Function 3DH (0x3D or 61) --> Open file
Call with: AH = 3DH
AL = access mode
Access mode bits significance is given in the following table:
Bits |
Significance |
0 – 2 |
Access Mode
000 = read access
001 = write access
010 = read/write access |
3 |
Reserved (0) |
4 – 6 |
Sharing Mode
000 = compatibility mode
001 = deny all
010 = deny write
011 = deny read
100 = deny none |
7 |
Inheritance flag
0 = child process inherits handle
1 = child does not inherit handle |
DS: DX = segment: offset of ASCIIZ pathname
Returns: If function successful
Carry flag = clear
AX = handle
If function unsuccessful
Carry flag = set
AX = error code
Comments:
If an ASCIIZ pathname is given, this function opens the specified file in the designated or default directory on the designated or default disk drive. A handle is returned which can be used by the program for subsequent access to the file.
INT 21H (0x21)
Function 3EH (0x3E or 62) --> Close file
Call with: AH = 3EH
BX = handle
Returns: If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function flushes all internal buffers associated with the file to disk, closes the file, and releases the handle for reuse, of previously open or created with success of a given handle. If the file was modified, the time and date stamp and file size are updated in the directory entry of the file.
INT 21H (0x21)
Function 3FH (0x3F or 63) --> Read file or device
Call with: AH = 3FH
BX = handle
CX = number of bytes to read
DS: DX = segment: offset of buffer
Returns: If function successful
Carry flag = clear
AX = byte transferred
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function transfers data at the current file-pointer position from the file into the buffer and then updates the file pointer position for a given valid file handle from a previous open or create operation, a buffer address, and a length in bytes.
INT 21H (0x21)
Function 40H (0x40 or 64) --> Write file or device
Call with: AH = 40H
BX = handle
CX = number of bytes to write
DS: DX = segment: offset of buffer
Returns: If function successful
Carry flag = clear
AX = byte transferred
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function transfers data from the buffer into the file and then updates the file pointer position for given valid file handle from a previous open or create operation, a buffer address, and a length in bytes. If the function is called with CX = 0, the file is truncated or extended to the current file pointer position.
INT 21H (0x21)
Function 41H (0x41 or 65) --> Delete file
Call with: AH = 41H
DS: DX = segment: offset of ASCIIZ pathname
Returns: If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Call with: AH = 40H
BX = handle
CX = number of bytes to write
DS: DX = segment: offset of buffer
Returns: If function successful
Carry flag = clear
AX = byte transferred
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function transfers data from the buffer into the file and then updates the file pointer position for given valid file handle from a previous open or create operation, a buffer address, and a length in bytes. If the function is called with CX = 0, the file is truncated or extended to the current file pointer position.
INT 21H (0x21)
Function 41H (0x41 or 65) --> Delete file
Call with: AH = 41H
DS: DX = segment: offset of ASCIIZ pathname
Returns: If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Comments:
This function deletes a file from the default or specified disk and directory. The function deletes a file by replacing the first character of its filename in the root directory with the character E5H (0xE5) and making the file’s clusters as available for the new data in the file allocation table. Till then actual data stored in those clusters is not overwritten.
INT 21H (0x21)
Function 42H (0x42 or 66) --> Set file pointer
Call with: AH = 42H
AL = method code
00H absolute offset from start of file
01H signed offset from current file
pointer
02H signed offset from end of file
BX = handle
CX = most significant half of offset
DX = least significant half of offset
Returns: If function is successful
Carry flag = clear
DX = most significant half of resulting file
pointer
AX = least significant half of resulting file
pointer
If function is unsuccessful
Carry flag = set
AX = error code
Comments:
This function sets the file pointer location relative to the start of file, end of file, or current file position.
This function deletes a file from the default or specified disk and directory. The function deletes a file by replacing the first character of its filename in the root directory with the character E5H (0xE5) and making the file’s clusters as available for the new data in the file allocation table. Till then actual data stored in those clusters is not overwritten.
INT 21H (0x21)
Function 42H (0x42 or 66) --> Set file pointer
Call with: AH = 42H
AL = method code
00H absolute offset from start of file
01H signed offset from current file
pointer
02H signed offset from end of file
BX = handle
CX = most significant half of offset
DX = least significant half of offset
Returns: If function is successful
Carry flag = clear
DX = most significant half of resulting file
pointer
AX = least significant half of resulting file
pointer
If function is unsuccessful
Carry flag = set
AX = error code
Comments:
This function sets the file pointer location relative to the start of file, end of file, or current file position.
|