Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TASM 2.x / MASM 6.x Assembly Language - <b>int 25h (37) absolute disk read</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
INT 25h (37)             Absolute Disk Read

    Reads one or more sectors on a specified logical disk.

       On entry:      AL         Drive number (0=A, 1=B)
                      CX         Number of sectors to read
                      DX         Starting sector number
                      DS:DX      Buffer to store sector read

       Returns:       AX         Error code (if CF is set; see below)
                      Flags   DOS leaves the flags on the stack

    For DOS 4.+ >32MB disk access:

        On entry:      AL         Drive number (0=A, 1=B,...)
                       CX         0FFFFH . indicates extended format
                       DS:BX      Address of Control Packet (see below)

                       Control Packet:
                       DD       SECTOR  ;Logical sector number (0 origin)
                       DW       COUNT   ;Number of sectors to read
                       DD       BUFFER  ;DS:Offset of data buffer

        Returns:       AX        Error code (if CF is set; see below)
                       Flags     DOS leaves the flags on the stack

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

    This DOS service (and its write counterpart, Interrupt 26h) is
    comparable to service provided by the ROM-BIOS in Interrupt 13h,
    except for these two differences:

     1.  DOS numbers disk sectors sequentially, starting at cylinder 0,
         head 0, sector 1. The BIOS service identifies sectors by three
         separate coordinates--cylinder, head, and sector). The following
         formula converts BIOS-numbered sectors to the DOS format:

      DOS.Sector.Number = (BIOS.Sector-1) + BIOS.Head * Sectors.per.Head +
                          BIOS.Cylinder * Sectors.per.Head * Heads.per.Disk

     2.  DOS works with logical drives, while the BIOS works with physical
         drives only. That means that the DOS interrupt can be used to
         read a phantom drive B, a RAM drive, or a logical drive that has
         been mapped to a nondefault physical drive via the ASSIGN
         command.

    Error information is reported in AX as follows:

              Error code in AH:

                01h       Invalid command
                02h       Address mark not found
                03h       Attempt to write on write-protected diskette
                04h       Sector not found
                05h       Reset failure
                07h       Drive parameter activity failure
                08h       DMA overrun
                09h       DMA boundary error
                10h       CRC or ECC data error

                11h       Possible error corrected by ECC (AL contains
                          burst length)
                20h       Controller failure
                40h       Bad seek
                80h       Drive timeout
                BBh       Undefined error
                FFh       Sense operation failure

              Error code in AL:

                00h       Write-protect error
                01h       Invalid drive number
                02h       Drive not ready
                03h       Invalid command
                04h       CRC error
                05h       Bad request structure length
                06h       Seek error
                07h       Unknown medium; disk format not recognized
                08h       Sector not found
                09h       Printer out of paper
                0Ah       Write error
                0Bh       Read error
                0Ch       General, nonspecific error

    Note that the AH error information is the same as that returned in AH
    by Interrupt 13h, Service 2, and the AL error information is the same
    returned in DL in response to a critical error (Interrupt 24h).

    Following a call to Interrupt 25h, DOS leaves one word (the flag
    contents at the time the interrupt was invoked) on the stack. You
    should POP this word to prevent stack growth.

    For extended disks under DOS 4+, you pass the address of a Control
    Packet in DS:BX. This extended support is offered because DOS 4+ can
    support disks with media larger than 32MB.

    The control packet is made up of the following fields:

                       Control Packet:
                       DD       SECTOR  ;Logical sector number (0 origin)
                       DW       COUNT   ;Number of sectors to read
                       DD       BUFFER  ;DS:Offset of data buffer

    You pass a doubleword logical sector number, followed by a one-word count
    of sectors to read, and then the doubleword address of the data buffer.
    If you use conventional parameters and try to access media greater than
    32MB, the error returned in AX is 0207H.

    Before you use INTs 25h or 26h, DOS 4+ must know how a disk or diskette
    is formatted. With hard disks, this is not a problem, but if you are
    using a diskette, you should call INT 21h, function 47h (Get Current
    Directory) before using INTs 25h or 26h.

See Also: INT 26h INT 13h, 02h

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