Partial answer so far.
Every resource begins with a 32-bit size field before the resource data itself.
So "CODE0" has one format and "CODE" two formats. It would seem there's aThe normal/standard (near) format for the near model and a "far"special format for the far model. If the first 16-bit field of the CODE resource is 0xffff then it's in the "far" format for the far model. Otherwise it's in the normal near model format.
The far model is also described with the term "32-bit-everywhere". I don't know what allthink this hints at the fields mean yetearliest Mac operating systems using the high 8 bits of addresses for flags or such since the original 68000 CPU only used 24 bits for addresses. push_opcodeWhen later 680x0 CPUs came out they used the full 32 bits and trap_opcode for instance seem quite specialthe Mac operating system would have adapted to it.
As noted in other comments and answers the structure is documented in Chapter 10, "Classic 68K Runtime Architecture" of "Mac OS Runtime Architectures For System 7 Through Mac OS 9". There's a lot of information in there besides the description of the records in the file. The references toparts I was looking for are:
For the format of a5CODE are aboutresource #0:
- Page 10-9, Figure 10-3 "The 'CODE'0 resource"
- Page 10-10, Figure 10-4 "An unloaded jump table entry"
For the classic Mac fundamenal programming conceptformat of normal "The A5 World" that's always pointedCODE resources:
- Page 10-12, Figure 10-6 "Near model segment header"
- Page 10-24, Figure 10-11 "The far model segment header"
I can't find where or if this document covers the general format of the resource as beginning with a 32-bit integer size field, so I'm glad I figured that out.
If all you want is to bylocate the m68k'sm68k machine code, then:
Iterate through the resources, look for a5CODE registerresources, skipping the one numbered 0. For the others, check the 16-bit field at offset 0x04. If it's 0xffff then the code starts at offset 0x2c, otherwise the code starts at offset 0x08.