GetToolTrapAddress
#include <OSUtils.h> Operating System Utilities
returns address of the trap handling code
of the toolbox 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 trapNum identifies the ROM routine whose address you want. See TrapWords for a list.
Returns: a 32-bit value; the address of the system routine that corresponds to trapNum.
called, depending on which trap dispatch table you wish to modify. It is
recommended that you use one of these routines in place of
tool traps and OS traps.
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