Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <bios.h>
    unsigned short _bios_disk( unsigned service,
                               struct diskinfo_t *diskinfo );
    struct  diskinfo_t {        /* disk parameters   */
            unsigned drive;     /* drive number      */
            unsigned head;      /* head number       */
            unsigned track;     /* track number      */
            unsigned sector;    /* sector number     */
            unsigned nsectors;  /* number of sectors */
            void __far *buffer; /* buffer address    */
    };

Description:
    The _bios_disk function uses INT 0x13 to provide access to the BIOS disk
    functions.  Information for the desired service is passed the diskinfo_t
    structure pointed to by diskinfo.  The value for service can be one of
    the following values:

    _DISK_RESET
        Forces the disk controller to do a reset on the disk.  This request
        does not use the diskinfo argument.

    _DISK_STATUS
        Obtains the status of the last disk operation.

    _DISK_READ
        Reads the specified number of sectors from the disk.  This request
        uses all of the information passed in the diskinfo structure.

    _DISK_WRITE
        Writes the specified amount of data to the disk.  This request uses
        all of the information passed in the diskinfo structure.

    _DISK_VERIFY
        Checks the disk to be sure the specified sectors exist and can be
        read.  A CRC (cyclic redundancy check) test is performed.  This
        request uses all of the information passed in the diskinfo structure
        except for the buffer field.

    _DISK_FORMAT
        Formats the specified track on the disk.  The head and track fields
        indicate the track to be formatted.  Only one track can be formatted
        per call.  The buffer field points to a set of sector markers, whose
        format depends on the type of disk drive.  This service has no
        return value.


Returns:
    The _bios_disk function returns status information in the high-order
    byte when service is _DISK_STATUS, _DISK_READ, _DISK_WRITE, or
    _DISK_VERIFY.  The possible values are:

    0x00
        Operation successful

    0x01
        Bad command

    0x02
        Address mark not found

    0x03
        Attempt to write to write-protected disk

    0x04
        Sector not found

    0x05
        Reset failed

    0x06
        Disk changed since last operation

    0x07
        Drive parameter activity failed

    0x08
        DMA overrun

    0x09
        Attempt to DMA across 64K boundary

    0x0A
        Bad sector detected

    0x0B
        Bad track detected

    0x0C
        Unsupported track

    0x10
        Data read (CRC/ECC) error

    0x11
        CRC/ECC corrected data error

    0x20
        Controller failure

    0x40
        Seek operation failed

    0x80
        Disk timed out or failed to respond

    0xAA
        Drive not ready

    0xBB
        Undefined error occurred

    0xCC
        Write fault occurred

    0xE0
        Status error

    0xFF
        Sense operation failed


Example:
    #include <stdio.h>
    #include <bios.h>

    void main()
      {
        struct diskinfo_t di;
        unsigned short status;

        di.drive = di.head = di.track = di.sector = 0;
        di.nsectors = 1;
        di.buffer = NULL;
        status = _bios_disk( _DISK_VERIFY, &di );
        printf( "Status = 0x%4.4X\n", status );
      }

Classification:
    BIOS

Systems:
    DOS, Win, NT, DOS/PM

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