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

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

       On 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

       Returns:       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.

       Notes:         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 26h INT 13h, 0Bh INT 13h, 02h

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