Important: The information in this document is obsolete and should not be used for new development.
NSetTrapAddress
You can use theNSetTrapAddressprocedure to install a patch address into either an Operating System trap dispatch table or a Toolbox trap dispatch table.
PROCEDURE NSetTrapAddress (trapAddr: LongInt; trapNum: Integer; tTyp: TrapType);
trapAddr- The patch address.
trapNum- A-line instruction or a trap number. If you specify a A-line instruction, the function extracts the trap number you.
tTyp- The trap type. If you supply the
tTypparameter with the constantOSTrap, theNSetTrapAddressprocedure installs the address into the Operating System trap dispatch table. If you supply thetTypparameter with the constantToolTrap, theNGetTrapAddressfunction installs the address into the Toolbox trap dispatch table.DESCRIPTION
TheNSetTrapAddressprocedure places the patch addressspecified by thetrapAddrparameter into a trap dispatch table. Use thetTypparameter to specify whether the patch address belongs in the Operating System trap dispatch table or the Toolbox trap dispatch table. IftTypisOSTrap, theNSetTrapAddressprocedure installs the address into the Operating System trap dispatch table. IftTypisToolTrap, theNGetTrapAddressfunction installs the address into the Toolbox trap dispatch table. Use thetrapNumparameter to specify the location of the patch address in the dispatch table. The trap number may be any word value; its irrelevant high-order bits are masked according to the value of thetTypparameter.
- Note
- If the system software routine that is being patched has a come-from patch, the
NSetTrapAddressprocedure installs the address of the patch into the exit JMP instruction of the come-from patch (rather than into the trap dispatch table).![]()
- WARNING
- If the first 4 bytes of the
trapAddrparameter is $60064EF9 (indicating a come-from patch),NSetTrapAddresstriggers a system error.![]()
ASSEMBLY-LANGUAGE INFORMATION
The registers on entry for the_SetTrapAddressmacro are
Registers on entry D0 An A-line trap word A0 Address of next routine in the daisy chain (a system software routine or a patch) When calling the
_SetTrapAddressmacro, you set bit 9 of the A-line trap word to indicate a "new" system; that is, any version since the Macintosh Plus or Macintosh 512K. You use bit 10 to indicate whether the system software routine that is being patched 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 words
newToolandnewOSto be used as arguments in the_SetTrapAddressmacro.Given an A-line instruction in register D0 and a system software address in register A0, you set the Toolbox routine with the trap number in register D0 to have the address in A0, you use the macro
_SetTrapAddress newToolThis is equivalent to callingNSetTrapAddress(trapAddr, trapNum, newTool). ThetrapAddrparameter is the address placed in register A0.ThetrapNumparameter is the A-line instruction placed in D0 for the assembly-language call. Similarly, to set the address of an Operating System trap whose A-line instruction is in register D0 to the address in register A0 you use the macro
_SetTrapAddress newOSThis is equivalent to callingNSetTrapAddress(trapAddr, trapNum, newOS).SEE ALSO
TheUnimplementedprocedure is described next. For information about theNGetTrapAddressfunction, see page 8-27. For an example of how to use theNSetTrapAddressfunction, see Listing 8-5 on page 8-24.