Platform SDK: Win32 API

Int 21h Function 7305h Ext_ABSDiskReadWrite (FAT32)

Allows absolute disk read/write to FAT32, FAT16, and FAT12 drives. This call replaces Int 25h/26h.

mov  si, 6001h          ;write normal file data. SI=0 for read
                        ;see "In Write Mode" below for more write values

mov  cx, -1             ;cx must be -1
mov  dx, seg Buffer     
mov  ds, dx
mov  bx, offset Buffer  ;See below
mov  dl, DriveNum       ;See below

mov  ax, 7305h          ;Ext_ABSDiskReadWrite
int 21h

jc  error_handler       ;carry set means error

Parameters

Buffer
Points to a DISKIO structure that contains the starting sector, the sector count and an address of the buffer to receive the data. The structure must be initialized according to Int 25h/26h documentation. The DISKIO structure has the following form:
DISKIO  STRUC
    diStartSector   dd  ?   ;sector number to start
    diSectors       dw  ?   ;number of sectors
    diBuffer        dd  ?   ;address of buffer
DISKIO  ENDS
DriveNum
The 1-based drive number (0=default; 1=A, 2=B, and so on).

This function operates the same as Int 25h/26h, with the following exceptions:

CX must equal -1 (only the 32-bit starting sector number form is allowed).

The drive number is 1-based (0 = default drive) and is specified in DL instead of AL.

This call does not leave a flag word on the stack like Interrupts 25h and 26h.

This call modifies only the AX register and the flags.

Bit 0 of SI specifies whether the call is to do a READ (INT 0x25) or a WRITE (INT 0x26).
SI bit 0 Read/write mode
Clear READ
Set WRITE

When bit 0 of SI is set (that is, WRITE mode), bits 13, 14 and 15 of SI categorize what type of data is being written:
15 14 13 Description
0 0 0 Other/Unknown.
0 0 1 FAT data.
0 1 0 Directory data.
0 1 1 Normal file data.
1 x x Reserved. Bit 15 must be 0.

All other bits of SI (1 through 12) are reserved and must be 0.

This provides information to apps (like compression drivers) so that they can write the data properly based upon the data type specified by the above bits.

Return Values

If the function is successful, clears the carry flag. Otherwise, sets the carry flag, and sets the AX register with the error code as it is documented for Int 25h/26h.

Remarks

When calling this function with DeviceIoControl, it is recommended to set the dwloControlCode parameter to VWIN32_DIOC_DOS_DRIVEINFO (defined as 6 in VWIN32.H). For more information, see Using VWIN32 to Carry Out MS-DOS Functions.

Warnings

Do not set these flags in an attempt to make a compression driver write uncompressed data onto a compressed drive. Compression drivers are not the only applications use these flags.

Do not set the flags improperly, this information is to be used only to indicate what "type" the data is.