[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


   NAME
        InitResident - initialize resident module

   SYNOPSIS
        object = InitResident(resident, segList)
        D0                     A1        D1

        aptr initresident(struct resident *,ulong);

   FUNCTION
        Initialize a ROMTag.  ROMTags are used to link system modules
        together.  Each disk based device or library must contain a
        ROMTag structure in the first code hunk.

        Once the validity of the ROMTag is verified, the RT_INIT pointer
        is jumped to  with the following registers:
                D0 = 0
                A0 = segList
                A6 = execbase

   INPUTS
        resident - Pointer to a ROMTag
        segList  - SegList of the loaded object, if loaded from disk.
                   Libraries & Devices will cache this value for later
                   return at close or expunge time.  Pass NULL for ROM
                   modules.

   RESULTS
        object  - Return value from the init code, usually the library
                  or device base.  NULL for failure.

   AUTOINIT FEATURE
        An automatic method of library/device base and vector table
        initialization is also provided by InitResident().  The initial code
        hunk of the library or device should contain "MOVEQ #-1,d0; RTS;".
        Following that must be an initialized resident structure with
        RTF_AUTOINIT set in rt_Flags, and an rt_Init pointer which points
        to four longwords.  These four longwords will be used in a call
        to MakeLibrary();

            - The size of your library/device base structure including initial
              library or device structure.

            - A pointer to a longword table of standard, then library
              specific function offsets, terminated with -1L.
              (short format offsets are also acceptable)

            - Pointer to data table in exec/initstruct format for
              initialization of library or device structure.

            - Pointer to library initialization function, or NULL.
                Calling sequence:
                        D0 = library base
                        A0 = segList
                        A6 = execbase
              This function must return in D0 the library/device base to be
              linked into the library/device list.  If the initialization
              function fails, the device memory must be manually deallocated,
              then NULL returned in D0.

   SEE ALSO
        exec/resident.i, findresident()