NGetTrapAddress
#include <OSUtils.h> Operating System Utilities
short trapType ; 0=OS trap, 1=Toolbox trap
returns address of the trap handling code
the trap dispatch table. Starting with the 128K ROMs, the Toolbox routines
have a trap dispatch table separate from the Operating System routines. You
must use this function (and not GetTrapAddress) if you are running with trapNum identifies the ROM routine whose address you want. See TrapWords for a list.
trapType differentiates between traps by type, since the 128K ROMs uses
two separate trap dispatch tables. This must be one of:
OSTrap (0) Operating System trap
ToolTrap (1) Toolbox trap
Returns: a 32-bit value; the address of the system routine that corresponds to trapNum.
Notes: There is a new interface to this routine, consisting of the calls
require the specification of the trap type as a parameter.
It is possible to intercept OS or Toolbox calls and perform pre- or
post- processing, or even replace the function altogether. This sort of
custom patching is normally written in assembly language.
There is a great deal of overhead involved in the Macintosh trap dispatch
mechanism. In time-critical situations, you may save a significant amount
of time by calling the system routine directly, rather than using the normal
invocation of a trap.
The trap dispatcher changed between the 64K and 128K ROMs.See