INT 21H (0x21)
Function 15H (0x15 or 21) --> Sequential write
Call with: AH = 15H
DS: DX = segment: offset of previously opened
file control block
Returns: AL = 00H, if write successful
01H, if disk is file
02H, if segment wrap
Comments:
This function writes the next sequential block of data into a file, then increments the file pointer appropriately. The number of bytes of data to be written is specified by the record size-field (offset 0EH) of the file control block (FCB).
INT 21H (0x21)
Function 16H (0x16 or 22) --> Create file
Call with: AH = 16H
DS: DX = segment: offset of unopened file control block
Returns: If function is successful and file was created or truncated
AL = 00H
And FCB filled in by MS-DOS as follows:
Drive field (offset 00H) = 1 for drive A, 2 for drive B, etc.
Current block field (offset0CH) = 00H
Record size field (offset 0EH) = 0080H
Size field (offset 10H) = file size from directory
Date field (offset 14H) = date stamp from directory
Time field (offset 16H = time stamp from directory |
If function unsuccessful (directory full)
AL = FFH
Comments:
This function creates a new directory entry in the current directory or truncates any existing file with the same name to zero length. Also opens the file for subsequent read/write operations. This function must be used with caution because an existing file with the specified name is truncated to zero length and all data in that file is irretrievably lost.
INT 21H (0x21)
Function 17H (0x17 or 23) --> Rename file
Call with: AH = 17H
DS: DX = segment: offset of special file control block
Returns: If function is successful and one or more files renamed
AL = 00H
If function is unsuccessful and no matching files, or new filename matched an existing file
AL = FFH
Comments:
This function changes the name of all matching files in the current directory on the disk in the specified drive.
You can also use wild cards with this. The special file control block has a drive code, filename, and extension in the usual position (bytes 0 through 0BH) and a second filename starting 6 bytes after the first (offset 11H).
INT 21H
Function 18H (0x18 or 24) --> Reserved
INT 21H (0x21)
Function 19H (0x19 or 25) --> Get current disk
Call with: AH = 19H
Returns: AL = drive code (0 for A drive, 1 for B
drive etc.)
Comments:
This function returns the drive code of the current or default disk drive.
INT 21H (0x21)
Function 1AH (0x1A or 26) --> Set DTA address
Call with: AH = 1AH
DS: DX = segment: offset of disk transfer area.
Returns: Nothing
Comments:
This function specifies the address of the disk transfer area (DTA) to be used for subsequent FCB-related function calls.
INT 21H (0x21)
Function 1BH (0x1B or 27) --> Get default drive data
Call with: AH = 1BH
Returns: If function successful
AL = sectors per cluster
DS: DX = segment offset of media ID byte
CX = size of physical sector in bytes
DX = number of clusters for default drive
If function unsuccessful (invalid drive or critical error)
AL = FFH
Comments:
This function obtains selected information about the default disk drive and a pointer to the media identification byte from its file allocation table.
The media ID byte has the following meanings:
Media Descriptor ID |
Medium |
0F0H |
3.5-inch Floppy Disk, double-sided, 18 sectors (or other) |
0F8H |
fixed disk |
0F9H |
5.25-inch Floppy Disk, double-sided, 15 sectors |
0F9H |
3.5-inch Floppy Disk, double-sided, 9 sectors |
0FCH |
5.25-inch Floppy Disk, single-sided, 9 sectors |
0FDH |
5.25-inch Floppy Disk, double-sided, 9 sectors |
0FDH |
8-inch Floppy Disk, single sided, single density |
0FEH |
5.25-inch Floppy Disk, single-sided, 8 sectors |
0FEH |
8-inch Floppy Disk, Single Sided, Single Density |
0FEH |
8-inch Floppy Disk, Double Sided, Double Density |
0FFH |
5.25-inch Floppy Disk, double-sided, 8 sectors |
|