Int 13h, 0Bh            Write Long                                diagnostics

Writes one or more long sectors to a fixed disk from memory. A
long sector is a sector of information plus 4 bytes representing
the ECC code for the sector. This service can be performed on
fixed disks only.

Entry AH = 0Bh
AL = Number of sectors to write (1-127)
CH = Cylinder number (10-bit value; upper 2 bits in CL)
CL = Starting sector number
DH = Head number
DL = Drive number (Bit 7 must be set)
ES:BX = Address of memory buffer

Return AH = Status of operation (See Service 01h)
AL = Number of sectors written
CF Set if error, else cleared

Writes the information at a memory buffer to the sectors starting
at the specified location (head, cylinder, and track)


Note
This service is for diagnostics only. For a more generalized
version, see Service 03h, which writes sectors for both diskettes
and fixed disks. Also see Int 26h (DOS), which allows the writing
of absolute sectors from any type of block device.

The cylinder number is a ten-bit quantity (0 through 1023). Its
most significant two bits are in bits 7 and 6 of CL; the remaining
eight bits are in CH. The starting sector number fits in the
low-order portion (lower 6 bits) of CL.

The value returned in AL (number of sectors written) may not give
the correct number of sectors, even though no writing error has
occurred. Use the results of the Carry flag and AH (status flag)
to determine the status of the operation.

The number of sectors to write (AL) can be 127 sectors at most.

If an error is encountered while writing a sector, use Service 0h
to reset the drive and retry the operation. It is recommended that
at least 3 retries be attempted before an error is signalled,
since the error may have resulted from the diskette motor not
being up to speed.

Because of the architecture of the DMA channel, an error will
occur if the buffer in memory for the sectors overlaps a 64K page
boundary. A 64K page boundary is a memory location which is one of
the following (10000h, 20000h, 30000h, etc.). Ensure that no part
of your buffer falls on such a boundary. If it does, then create a
new buffer or start the buffer just after the boundary.

For the AT, XT-286, and PC Convertible, the BIOS executes Int 15h,
Service 90h (Device Busy), for the diskette (Type = 01h) and the
fixed disk (Type = 00h) prior to waiting for the interrupt. Int
15h, Service 91h (Interrupt Complete), is executed upon
completion.