INT 21H (0x21)
Function 0DH (0x0D or 13) -> Disk reset
Call with: AH = 0DH
Returns: Nothing
Comments:
This function flushes all file buffers. The function does not update the disk directory for any files that are still open.
INT 21H (0x21)
Function 0EH (0x0E or 14) -> Select disk
Call with: AH = 0EH
DL = drive code (0 = A, 1= B, etc.)
Returns: AL = number of logical drives in system
Comments:
Selects the specified drive to be current or default, disk drive and returns the total number of logical drives in the system.
The applications should limit themselves to the drive letters A-Z (0 = A, 1 = B, etc.). Logical drives means, the total number of block devices such as floppy disk and hard-disk drives etc. Generally A single physical hard-disk drive is partitioned into two or more logical drives.
INT 21H (0x21)
Function 0FH (0x0F or 15) -> Open file
Call with: AH = 0FH
S: DX = segment: offset of file control block
Returns: If function successful and file found
AL = 00H
And FCB filled in by MS-DOS is as follows:
Drive field (offset 00H) =1 for drive A, 2 for drive B, etc. Current block field (offset 0CH) = 00H
Record size field (offset 0EH) = 0080H
Size field (offset 10H) = file size from directory
Data field (offset 14H) = date stamp from directory
Time field (offset 16H) = time stamp from directory
|
If function unsuccessful and file not found
AL = 0FFH
Comments:
Opens a file and makes it available for subsequent read/write operation. If the program is going to use a record size other than 128 bytes, it should set the record-size field at FCB offset 0EH after the file is successfully opened and before any other disk operation.
INT 21H (0x21)
Function 10H (0x10 or 16) -> Close file
Call with: AH = 10H
DS: DX = segment: offset of file control block
Returns: If function successful (directory update successful)
AL = 00H
If function unsuccessful (file not found in directory)
AL = FFH
Comments:
It is used to close a file. It closes a file, flushes all MS-DOS internal disk buffers associated with the file to disk, and updates the disk directory if the file has been modified or extended.
INT 21H (0x21)
Function 11H (0x11 or 17) -> Find first file
Call with: AH = 11H
DS: DX = segment: offset of file control block
Returns: If function successful and matching file found
AL = 00H
And buffer at current disk transfer area (DTA) address filled in as an unopened normal FCB or extended FCB, depending on which type of FCB was input to function.
If function unsuccessful (no matching filename found)
AL = FFH
Comments:
It searches the current directory on the designated drive for a matching filename. You can use wildcards (? and *). This function returns first matching filename.
INT 21H (0x21)
Function 12H (0x12 or 18) -> Find next file
Call with: AH = 12H
DS: DX = segment: offset of file control block
Returns: If function successful and matching filename found
AL = 00H
And buffer at current disk transfer area (DTA) address set up as an unopened normal FCB or extended FCB, depending on which type of FCB was originally input to INT21H function 11H
If function unsuccessful and matching filenames not found
AL = FFH
Comments:
This is the companion of the previous function. If INT 21H Function 11H has been successful, it returns the next matching filename, if any. This function assumes that the FCB used as input has been properly initialized by a previous call to INT 21H Function 11H and possible subsequent calls to INT 21H Function 12H and that the filename or extension being searched for contained at least one wildcard character.
INT 21H (0x21)
Function 13H (0x13 or 19) -> Delete file
Call with: AH = 13H
DS: DX = segment: offset of file control block
Returns: If function is successful and file or files deleted
AL = 00H
If function is unsuccessful and no matching files were found or at least one matching file was read-only,
AL = FFH
Comments:
It deletes all matching files from the current directory on the default or specified disk drive. You can also use wildcards (? and *).
INT 21H (0x21)
Function 14H (0x14 or 20) -> Sequential read
Call with: AH = 14H
DS: DX = segment: offset of previously opened
file control block
Returns: AL = 00H if read successful
01H if end of file
02H if segment wrap
03H if partial record read at end of
file
Comments:
This function reads the next sequential block of data from a file, then increments the file pointer appropriately. The number of bytes of data to be read is specified by the record-size field (offset 0EH) of the file control block (FCB).
The record is read into memory at the current disk transfer area (DTA) address, specified by the most recent call to INT 21H Function 1AH. If the size of the record and the location of the buffer are such that a segment overflow or wraparound would occur, the function fails with a return code of 02H.
|