Important: The information in this document is obsolete and should not be used for new development.
InsertSRTRec
You can use theInsertSRTRec
function to add an sResource to the slot resource table.
FUNCTION InsertSRTRec (spBlkPtr: SpBlockPtr): OSErr;
- spBlkPtr
- A pointer to a Slot Manager parameter block.
--> spsPointer
Ptr A NIL
pointer.--> spParamData
LongInt Either a value of 0 to enable the sResource or a value of 1 to disable it. --> spRefNum
Integer The device driver reference number. --> spSlot
SignedByte The slot number. --> spId
SignedByte The sResource ID. --> spExtDev
SignedByte The external device identifier. DESCRIPTION
TheInsertSRTRec
function installs an sResource from the firmware of a NuBus card into the slot resource table. For example, if the user makes a selection in the Monitors control panel that requires your video card to switch to a new sResource that was deleted byPrimaryInit
code, you can use theInsertSRTRec
function to restore that sResource.You specify an sResource with the
spSlot
,spID
, andspExtDev
fields of the Slot Manager parameter block you point to in the spBlkPtr parameter. You must set thespsPointer
field toNIL
. Set thespParamData
field to 1 to disable the restored sResource or to 0 to enable it.If you place a valid device driver reference number in the
spRefNum
field, the Slot Manager updates thedCtlDevBase
field in that device driver's device control entry (that is, in the device control entry that has that driver reference number in thedCtlRefNum
field). ThedCtlDevBase
field contains the base address of the slot device. For a video card this is the base address for the pixel map in the card'sGDevice
record (which is described in Inside Macintosh: Imaging With QuickDraw). For other types of cards the base address is optional and defined by the card designer.The base address consists of the card's slot address plus an optional offset that the card designer can specify using the
MinorBaseOS
orMajorBaseOS
entries of the sResource. The Slot Manager calculates the base address by using bit 2 (thef32BitMode
flag) of thesRsrcFlags
entry of the sResource. As shown in Table 2-4, the Slot Manager first checks the value of bit 2 of thesRsrcFlags
field, and then it checks for aMinorBaseOS
entry. If it finds one, it uses this value to create a 32-bit value to store in thedCtlDevBase
field. If it does not find aMinorBaseOS
entry, it uses the value in theMajorBaseOS
entry, if any.
- Note
- In this table, x represents any hexadecimal digit and s represents a slot number.
SPECIAL CONSIDERATIONS
TheInsertSRTRec
function is available only with version 1 or later of the Slot Manager. You can use theSVersion
function, described on page 2-30, to determine whether the Slot Manager is version 1 or later.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theInsertSRTRec
function are
Trap macro Selector _SlotManager $000A You must set up register D0 with the routine selector and register A0 with the address of the Slot Manager parameter block. When
_SlotManager
returns, register D0 contains the result code.
Registers on entry A0 Address of the parameter block D0 $000A
Registers on exit D0 Result code RESULT CODES
noErr 0 No error memFullErr -108 Not enough room in heap smUnExBusErr -308 Bus error smBadRefId -330 Reference ID not found in list smBadsList -331 Bad sResource: Id1 < Id2 < Id3 ... format is not followed smReservedErr -332 Reserved field not zero smSlotOOBErr -337 Slot number out of bounds smNoMoresRsrcs -344 Specified sResource not found smBadsPtrErr -346 Bad pointer was passed to SCalcSPointer
smByteLanesErr -347 ByteLanes
field in card's format block was determined to be zeroSEE ALSO
For more information about the slot resource table, see "About the Slot Manager" on page 2-15.For information about deleting an sResource from the slot resource table, see the
SDeleteSRTRec
function, described on page 2-52. For more information on deleting and restoring sResources, see "Deleting and Restoring sResources" on page 2-17.For more information about the device control entry and device driver reference numbers, see the chapter "Device Manager" in this book.