Interrupt 26h Absolute Disk Write

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 write

mov dx, FirstSector ;first logical sector to write

int 26h ;Absolute Disk Write

jc error_handler

popf ;MUST pop registers after int returns

Absolute Disk Write (Interrupt 26h) writes data from the specified buffer to one or more logical sectors on the specified drive.

This interrupt has been superseded. Programs should use Write Track on Logical Drive (Interrupt 21h Function 440Dh Minor Code 41h).

Parameters

Drive

Specifies the number of the drive to write to (0 = A, 1 = B, 2 = C, and so on).

Buffer

Points to either a buffer that contains data to write or 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 containing 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 write 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 write. If Sectors is 0FFFFh, this number is ignored and the starting sector must be specified in the DISKIO structure.

Return Value

If the interrupt is successful, the carry flag is clear. 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

00h Write-protection violation
01h Unknown unit
02h Drive not ready
04h Data error (CRC error)
06h Seek error
07h Unknown media
08h Sector not found
0Ah Write 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
03h Write-protection fault
04h Sector not found
10h Data error (CRC error)
20h Controller failure
40h Seek failure
80h No response from drive

Comments

Upon returning, Interrupt 26h leaves the CPU flags on the stack. Programs should check the carry flag for an error before popping the flags from the stack.

Interrupt 26h 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 26h writes logical sectors only. This means, for example, that the interrupt cannot write to hidden sectors.

See Also

Interrupt 21h Function 440Dh Minor Code 41h Write Track on Logical Drive
Interrupt 24h Critical-Error Handler
Interrupt 25h Absolute Disk Read