FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

FB II COMPILER

Toolbox traps



GETTRAPADDRESS won't work with Toolbox traps, only OS traps. As far as I could see you have to port the GetToolBoxTrapAddress & SetToolBoxTrapAddress for most of the new traps, but I could be wrong.

Here is a short demo that shows the differences in the two methods. On all the machines I tested, all of the traps except the first two require GetToolBoxTrapAddress...

WINDOW OFF
COORDINATE WINDOW
WIDTH = _NoTextWrap

DIM gUserQuits%
END GLOBALS

LOCAL
LOCAL FN GetToolboxTrapAddress(trapNum%)
  ` CLR.L -(SP)
  ` MOVE.W ^trapNum%,-(SP)
  ` DC.W $301F,$A746,$2E88
  ` MOVE.L (SP)+,D0
END FN = REGISTER(D0)

LOCAL FN DisplayBothMethods(theTrap%)
  TheTrapPtr& = FN GetToolboxTrapAddress(theTrap%)
  TheOtherTrapPtr& = FN GETTRAPADDRESS(theTrap%)

  PRINT "Trap: ";RIGHT$(HEX$(theTrap%),4)
  PRINT "GetToolboxTrapAddress Says: ",TheTrapPtr&

  PRINT "GETTRAPADDRESS Says: ",TheOtherTrapPtr&
  PRINT
END FN

WINDOW 1
TEXT _Monaco,9,0,0

FN DisplayBothMethods(_DrawPicture)
FN DisplayBothMethods(_ShowWindow)
FN DisplayBothMethods(_Pack8)
FN DisplayBothMethods(_Copymask)
FN DisplayBothMethods(_AliasDispatch)
FN DisplayBothMethods(_Fontmetrics)

DO
  HANDLEEVENTS
UNTIL gUserQuits%
END

Jamin