Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- BIOS ref. - <b>int 13h, 03h write sectors from memory all</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Int 13h, 03h            Write Sectors from Memory                         all

    Writes one or more sectors from memory to a fixed or floppy disk.

        Entry   AH    = 03h
                AL    = Number of sectors to write
                CH    = Cylinder number (10-bit value; upper 2 bits in CL)
                CL    = Starting sector number
                DH    = Head number
                DL    = Drive number
                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 specified number of sectors from the buffer at ES:BX to
    the specified location (head, cylinder, and track) on the disk.


    Note
    Values in DL less than 80h specify floppy disks; values greater
    than 80h specify fixed disks. For example, 0 means the first
    floppy diskette, while 80h means the first fixed disk.

    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 read) may not give the
    correct number of sectors, even though no error has occurred. Use
    the results of the Carry flag and AH (status flag) to determine
    the status of the operation.

    The sectors written must all be on the same cylinder and same side
    for diskettes, while a hard disk can write at most 128 sectors at
    one time.

    If an error is encountered 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.

    This service differs from the DOS Int 26h (Write absolute sector)
    in that the DOS Int 26h works with logical devices (RAM disks,
    Bernoulli drives, etc.). It is much more flexible. Also Int 26h
    works with a linear address, whereas this service works with 3
    coordinates to address a disk location. Int 26h doesn't have the
    DMA problem mentioned above, and there is no limit on the number
    of sectors that can be written in a single operation. In addition,
    Int 26h will do all of the error-retry attempts itself. Int 26h
    should be used instead of this service for obtaining absolute
    sector control. Programs that may need to use this service rather
    than Int 26h include partition table modifiers, system software,
    and disk cache software.

    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. Also diskette operations that require the diskette
    motor to be on will call Int 15h, Service 90 (Device Busy), with
    the type equal to "Diskette Drive Motor Start" (Type = FDh). This
    allows the system to perform another task while the drive motor is
    waiting to get up to speed.

See Also: Int 13h, 01h Int 13h, 0Bh Int 13h, 02h

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson