mov al, Drive ;0 = A, 1 = B, 2 = C, etc.
mov bx, seg Buffer
mov ds, bx
mov bx, offset Buffer ;ds:bx points to data buffer
mov cx, Sectors ;number of sectors to read
mov dx, FirstSector ;first logical sector to read
int 25h ;Absolute Disk Read
jc error_handler
popf ;MUST pop registers after int returns
Absolute Disk Read (Interrupt 25h) reads from one or more logical sectors on the specified drive and copies the data to the specified buffer.
This interrupt has been superseded. Programs should use Read Track on Logical Drive (Interrupt 21h Function 440Dh Minor Code 61h).
Drive
Specifies the number of the drive to read (0 = A, 1 = B, 2 = C, and so on).
Buffer
Points to either a buffer that receives data or to a DISKIO structure, depending on the value of the Sectors parameter. If Sectors is 0FFFFh, Buffer must point to a DISKIO structure that contains the starting sector, count of sectors, and address of the buffer to receive the data. 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
For a full description of the DISKIO structure, see Chapter 3, “File System.”
The DISKIO structure is required if the size of the specified drive is greater than 32 MB.
Sectors
Specifies either the number of sectors to read or 0FFFFh, depending on the size of the specified drive. If the drive size is greater than 32 MB, Sectors must be 0FFFFh.
FirstSector
Specifies the number of the first logical sector to read. If Sectors is 0FFFFh, this number is ignored and the starting sector must be specified in the DISKIO structure.
If the interrupt is successful, the carry flag is clear and the buffer contains the information read from the disk. Otherwise, the carry flag is set and the AL and AH registers contain error values. The AL register specifies device-driver errors and contains one of the following values:
Value | Meaning |
01h | Unknown unit |
02h | Drive not ready |
04h | Data error (CRC error) |
06h | Seek error |
07h | Unknown media |
08h | Sector not found |
0Bh | Read fault |
0Ch | General failure |
0Fh | Invalid media change |
For most computers, the AH register specifies ROM BIOS errors and may contain one of the following values:
Value | Description |
01h | Bad command |
02h | Address mark not found |
04h | Sector not found |
10h | Data error (CRC error) |
20h | Controller failure |
40h | Seek failure |
80h | No response from drive |
Upon returning, Interrupt 25h leaves the CPU flags on the stack. Programs should check the carry flag for an error before popping the flags from the stack.
Interrupt 25h does not process critical errors. If one occurs, the interrupt routine returns an error value to the program but does not issue Critical-Error Handler (Interrupt 24h).
Interrupt 25h reads logical sectors only. This means, for example, that it cannot read hidden sectors.
Interrupt 21h Function 440Dh Minor Code 61h Read Track on Logical Drive
Interrupt 24h Critical-Error Handler
Interrupt 26h Absolute Disk Write