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, 02h read sectors into memory all</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Int 13h, 02h            Read Sectors into Memory                          all

    Reads one or more sectors from a fixed or floppy disk into memory.

        Entry   AH    = 02h
                AL    = Number of sectors to read
                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 read
                CF   Set if error, else cleared

    ------------------------------------------------------------------

    Reads the specified number of sectors starting at the specified
    location (head, cylinder, and track) from a disk into a buffer
    starting at ES:BX.


    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 read must all be on the same cylinder and same side
    for diskettes, while a hard disk can read at most 128 sectors at
    one time.

    If an error is encountered reading a sector, use Service 0 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, create a new
    buffer or start the buffer just after the boundary.

    If an error 11h is returned, the data is good, but the BIOS
    reports that it was corrected using the ECC error-correcting
    algorithm. The error may not occur again if the information is
    written back out.

    This service differs from the DOS Int 25h (Read absolute sector)
    in that the DOS Int 25h works with logical devices (RAM disks,
    Bernoulli drives, etc.). It is much more flexible. Also Int 25h
    works with a linear address, whereas this service works with 3
    coordinates to address a disk location. Int 25h doesn't have the
    DMA problem mentioned above, and there is no limit on the number
    of sectors that can be read in one operation. In addition, Int 25h
    will do all the error-retry attempts itself. Int 25h should be
    used instead of this service for obtaining absolute sector
    control. Programs that may need to use this service rather than
    Int 25h include partition manipulators, 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, 0Ah Int 13h, 03h

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