Search code examples
macosassemblycalling-convention68000

What is on the 68000 stack when classic MacOS enters a program?


I'm trying to understand an old classic Mac application's entry point. I've disassembled the first CODE resource (not CODE#0, which is the jump table). The code refers to some variables off the stack: a word at 0004(A7), an array of long words of starting at 000C(A7) whose length is the value at 0004(A7), and a final long word beyond that array that seems to be a pointer to a character string.

The array of long words looks like strings at first glance, so it looks superficially like we're dealing with an (int argc, char ** argv) situation, except the "argv" array is inline in the stack frame.

What should a program be expecting on its stack / registers when it first gets called by the Mac OS?


Solution

  • From memory I don't think there is anything of interest on the stack when your CODE resource is first called. Classic Mac OS did not use argc/argv. It's been a long time though, so I could be wrong, and I threw out all my old Inside Mac volumes some years ago, so I can't easily check.