Important: The information in this document is obsolete and should not be used for new development.
NSetTrapAddress
You can use theNSetTrapAddress
procedure 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
tTyp
parameter with the constantOSTrap
, theNSetTrapAddress
procedure installs the address into the Operating System trap dispatch table. If you supply thetTyp
parameter with the constantToolTrap
, theNGetTrapAddress
function installs the address into the Toolbox trap dispatch table.DESCRIPTION
TheNSetTrapAddress
procedure places the patch addresss
pecified by thetrapAddr
parameter into a trap dispatch table. Use thetTyp
parameter to specify whether the patch address belongs in the Operating System trap dispatch table or the Toolbox trap dispatch table. IftTyp
isOSTrap
, theNSetTrapAddress
procedure installs the address into the Operating System trap dispatch table. IftTyp
isToolTrap
, theNGetTrapAddress
function installs the address into the Toolbox trap dispatch table. Use thetrapNum
parameter 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 thetTyp
parameter.
- Note
- If the system software routine that is being patched has a come-from patch, the
NSetTrapAddress
procedure 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
trapAddr
parameter is $60064EF9 (indicating a come-from patch),NSetTrapAddress
triggers a system error.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry for the_SetTrapAddress
macro 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
_SetTrapAddress
macro, 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
newTool
andnewOS
to be used as arguments in the_SetTrapAddress
macro.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)
. ThetrapAddr
parameter is the address placed in register A0.
ThetrapNum
parameter 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
TheUnimplemented
procedure is described next. For information about theNGetTrapAddress
function, see page 8-27. For an example of how to use theNSetTrapAddress
function, see Listing 8-5 on page 8-24.