Provides a direct linkage to the MS-DOS BIOS module to read data from a logical disk sector into memory.
Call with:
For access to partitions <= 32 MB
AL = drive number (0 = A, 1 = B, etc)
CX = number of sectors to read
DX = starting sector number
DS:BX = segment:offset of buffer
For access to partitions > 32 MB (MS-DOS 4.0 and later)
AL = drive number (0 = A, 1 = B, etc)
CX = -1
DS:BX = segment:offset of parameter block (see Notes)
Returns:
If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code (see Notes)
Notes:
All registers except the segment registers may be destroyed.
When this function returns, the CPU flags originally pushed on the stack by the INT 25H instruction are still on the stack. The stack must be cleared by a POPF or ADD SP,2 to prevent uncontrolled stack growth and to make accessible any other values that were pushed on the stack before the call to INT 25H.
Logical sector numbers are obtained by numbering each disk sector sequentially from cylinder 0, head 0, sector 1, and continuing until the last sector on the disk is counted. The head number is incremented before the track number. Logically adjacent sectors may not be physically adjacent, due to interleaving that occurs at the device-adapter level for some disk types.
The error code is interpreted as follows: The lower byte (AL) is the same error code that is returned in the lower byte of DI when an Int 24H is issued. The upper byte (AH) contains:
01H if bad command 02H if bad address mark 04H if requested sector not found 08H if direct memory access (DMA) failure 10H if data error (bad CRC) 20H if controller failed 40H if seek operation failed 80H if attachment failed to respond
[4.0+] When accessing partitions larger than 32 MB under MS-DOS version 4, this function uses a parameter block with the following format:
Bytes Description 00H—03H 32-bit sector number 04H—05H number of sectors to read 06H—07H offset of buffer 08H—09H segment of buffer
Example:
Read logical sector 1 of drive A into the memory area named buff. (On most MS-DOS floppy disks, this sector contains the beginning of the file allocation table.)
buff db 512 dup (?) ; receives data from disk
.
.
.
mov al,0 ; drive A
mov cx,1 ; number of sectors
mov dx,1 ; beginning sector number
mov bx,seg buff ; buffer address
mov ds,bx
mov bx,offset buff
int 25h ; request disk read
jc error ; jump if read failed
add sp,2 ; clear stack
.
.
.