Skip to main content
Home Forums 68kMLA Macintosh toolbox assembly reference? — #2
Post #2 by bigmessowires
Source Forum68kMLA
CategoryDevelopment
Post DateMon, 29 Dec 2014 - 01:27
Original URLhttps://68kmla.org/bb/threads/macintosh-toolbox-assembly-reference.920/
Post
I'll open my mouth, even though I don't have anything really useful to offer.

As far as I'm aware, the toolbox traps are basically designed for use with Pascal and C code, so they all use a consistent calling convention. Offhand I don't know what that convention is, but if you can't find it documented anywhere, you should be able to figure it out by examining the disassembly of a couple of toolbox routines.

Typically the calling convention has the arguments all pushed on the stack, either in left-to-right or right-to-left order as they appear in the trap function prototype. Possibly the first argument is passed in a register instead of on the stack. Then the return value (if any) is either returned on the top of the stack, or in a register. I seem to dimly recall that the Mac toolbox traps return their result in D0, but I may be wrong.

Once you figure this out, you should be able to use this calling convention and the normal Inside Macintosh documentation to call any toolbox trap from your assembly programs.

mp.ls