Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 2 - Slot Manager / Slot Manager Reference
Slot Manager Routines / Loading Drivers and Executing Code From sResources


You can use the SExec function to execute code stored in an sExecBlock data structure.

FUNCTION SExec (spBlkPtr: SpBlockPtr): OSErr;
A pointer to a Slot Manager parameter block.
-->spsPointerPtrA pointer to an sResource (described in "The sResource," beginning on page 2-7).
-->spsExecPBlkPtrA pointer to the SEBlock.
-->spIDSignedByteThe ID of the sExecBlock entry in the sResource.

The SExec function loads sExecBlock code from an sResource into the current heap zone, checks its revision level, and executes the code.

You specify the sExecBlock by providing a pointer to the sResource in the spsPointer field and the ID of the sExecBlock entry in the spID field. You must also provide in the spsExecPBlk field a pointer to a slot execution parameter block. The SEBlock structure allows you to provide information about the execution of the sExecBlock code.

The SExec function passes the sExecBlock code a pointer to the SEBlock structure in register A0.

The SExec function allocates memory; your application should not call this function at interrupt time.

The trap macro and routine selector for the SExec function are
Trap macroSelector

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
A0Address of the parameter block
Registers on exit
D0Result code

noErr0No error
smCodeRevErr-333The revision of the code to be executed by sExec was wrong
smCPUErr-334The CPU field of the code to be executed by sExec was wrong
smNoMoresRsrcs-344Requested sResource not found
For more information about the sExecBlock data structure, see page 2-9.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996