Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- DOS 5.0 Ref. - <b>device driver function 00h init b c</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Device driver function 00h      Init                    B   C

    Init directs the driver to initialize the device driver and
    corresponding device. This function is called only once, when the
    driver is loaded.

    This function is required for both block and character device
    drivers.

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

    The Init function is called only once; its code and data need not
    be retained after it has initialized its device. A device driver
    can release the Init function's code and data by placing the
    function at the end of the driver and returning the function's
    starting address in the irEndAddress field.

    If the Init function uses Int 21h system functions, it may use
    only the following functions:

                01h - 0Ch       Character I/O
                25h             Set Interrupt Vector
                30h             Get Version Number
                35h             Get Interrupt Vector

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

    irStatus
    Specifies the status of the completed function. If the function
    was successful, the driver must set the done bit (bit 8).
    Otherwise, the driver must set both the error and done bits (bits
    15 and 8) and copy an error value to the low-order byte.


    irUnits
    Specifies the number of units supported by the driver. DOS uses
    this number to assign sequential drive numbers to the units. The
    driver must set this field.


    irEndAddress
    Contains the 32-bit address (segment:offset) of the end of memory
    available to the device driver and receives the 32-bit address of
    of the end of the initialized driver.

        input   Points to the first byte of memory that immediately
                follows the device driver and which must not be used
                by the driver. During initialization, the driver may
                use any memory between its starting address and this
                address. The driver can also reserve some or all of
                this memory for use after initialization.
                (This field is not used for input in DOS versions
                earlier than version 5.0. The driver should check the
                DOS version number before using the value in this
                field.)
        output  Points to the first byte of memory that immediately
                follows the initialized driver. The driver must set
                this field to an address that is not greater than the
                end of available memory. If the driver fails to
                initialize, it should set this field to its starting
                address. This directs DOS to remove the driver and
                free all memory associated with it.


    irParamAddress
    Contains a 32-bit address (segment:offset) of the initialization
    parameters and receives a 32-bit address of an array of pointers
    to BPB structures.

        input   Points to the initialization parameters for the driver
                as copied from the CONFIG.SYS file. The parameters
                consist of the filename for the driver and any
                command-line switches - that is, all text on the
                corresponding DEVICE or DEVICEHIGH command line up to
                the terminating carriage-return character (0dh) or
                linefeed character (0ah) but not including the DEVICE
                or DEVICEHIGH command and equal sign.

        output  Points to an array of pointers to BPB structures.
                These structures specify the BIOS parameters for each
                unit supported by the drive. (Each pointer is a 16-bit
                offset relative to the start of the driver.)
                If all units are the same, all pointers in the array
                can be the same.

                Character device drivers must set the irParamAddress
                field to zero.


    irDriveNumber
    Contains the zero-based drive number for the driver's first unit
    as assigned by DOS. DOS supplies this number so that the driver
    can determine whether DOS will accept all its supported units. DOS
    allows no more than 26 units in the system.


    irMessageFlag
    Specifies whether DOS displays an error message on initialization
    failure. To direct DOS to display the message, the driver must set
    this field to 1. The message is displayed only if the driver also
    sets the irStatus field to indicate failure.

See Also: InitRequest BPB 30h 06h Dev*

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