Important: The information in this document is obsolete and should not be used for new development.
NGetTrapAddress
You can use theNGetTrapAddress
function to retrieve the address of either an Operating System routine or a Toolbox routine.
FUNCTION NGetTrapAddress (trapNum: Integer; tTyp: TrapType) :LongInt;
trapNum
- A-line instruction or a trap number. If you specify an A-line instruction, the function extracts the trap number for you.
tTyp
- The trap type. If you supply the
tTyp
parameter with the constantOSTrap
, theNGetTrapAddress
function retrieves the address from the Operating System trap dispatch table. If you supplytTyp
parameter with the constantToolTrap
, theNGetTrapAddress
function retrieves the address from the Toolbox trap dispatch table.DESCRIPTION
TheNGetTrapAddress
function returns the address of the system software routine specified by thetTyp
andtrapNum
parameters. IftTyp
isOSTrap
, theNGetTrapAddress
function retrieves the address from the Operating System trap dispatch table. IftTyp
isToolTrap
, theNGetTrapAddress
function retrieves the address from the Toolbox trap dispatch table. If the desired system software routine is not supported on the installed system software,NGetTrapAddress
returns the address of theUnimplemented
procedure. ThetrapNum
parameter should contain a trap number in bits 0-7 iftTyp
isOSTrap
, and in bits 0-9 iftTyp
isToolTrap
.The
trapNum
parameter may have any word value; its irrelevant high-order bits are masked according to the value of thetTyp
parameter.
- Note
- If the system software routine has a come-from patch, the
NGetTrapAddress
function returns the address of the routine immediately following the come-from patch.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for the_GetTrapAddress
macro are
Registers on entry D0 An A-line trap word
Registers on exit A0 Address of next routine in the daisy chain (a system software routine or a patch) When calling the
_GetTrapAddress
macro, you set bit 9 of the A-line instruction to indicate a "new" system; that is, any version since the Macintosh Plus or Macintosh 512K. You use bit 10 to indicate whether the trap in question is a Toolbox routine (by setting bit 10 to 1) or an Operating System routine (by setting bit 10 to 0). Macintosh development environments provide the modifier wordsnewTool
andnewOS
to be used as arguments in the_GetTrapAddress
macro.To obtain the address of a Toolbox trap whose number is in register D0, you use the macro
_GetTrapAddress newToolThis is equivalent to callingNGetTrapAddress
(trapNum, newTool
). ThetrapNum
parameter is the A-line trap word placed in register D0 for the assembly-language call. Similarly, to obtain the address of an Operating System routine whose A-line trap word is in register D0, you use the macro
_GetTrapAddress newOSThis is equivalent to callingNGetTrapAddress(trapNum, newOS)
.SEE ALSO
For information about theUnimplemented
procedure, see page 8-29. For information about theNSetTrapAddress
function, see page 8-30.