NSetTrapAddressYou can use the
NSetTrapAddressprocedure 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);
- The patch address.
- A-line instruction or a trap number. If you specify a A-line instruction, the function extracts the trap number you.
- The trap type. If you supply the
tTypparameter with the constant
NSetTrapAddressprocedure installs the address into the Operating System trap dispatch table. If you supply the
tTypparameter with the constant
NGetTrapAddressfunction installs the address into the Toolbox trap dispatch table.
NSetTrapAddressprocedure places the patch address
specified by the
trapAddrparameter into a trap dispatch table. Use the
tTypparameter to specify whether the patch address belongs in the Operating System trap dispatch table or the Toolbox trap dispatch table. If
NSetTrapAddressprocedure installs the address into the Operating System trap dispatch table. If
NGetTrapAddressfunction installs the address into the Toolbox trap dispatch table. Use the
trapNumparameter 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 the
- 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).
- If the first 4 bytes of the
trapAddrparameter is $60064EF9 (indicating a come-from patch),
NSetTrapAddresstriggers a system error.
ASSEMBLY-LANGUAGE INFORMATIONThe registers on entry for the
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
newOSto be used as arguments in the
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 calling
NSetTrapAddress(trapAddr, trapNum, newTool). The
trapAddrparameter is the address placed in register A0
trapNumparameter 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 calling
NSetTrapAddress(trapAddr, trapNum, newOS).
Unimplementedprocedure is described next. For information about the
NGetTrapAddressfunction, see page 8-27. For an example of how to use the
NSetTrapAddressfunction, see Listing 8-5 on page 8-24.