Technical Q&As


PPCSYS 04 - FAT Code Resources (1-May-95)


Q I'm still having problems creating FAT code resources. Here's what I need to know: What exactly is a PEF container? You mentioned in passing that it was the output of MakePEF. When I look at that output, it has no resources; yet the MixedMode.r file says to include the line:

$$Resource(BDef.rsrc", 'pCod', 128) // Specify name, type, and ID 	
of resourcecontaining a PEF container

How do I create a RESOURCE with a PEF container?

A The output of MakePEF normally goes to the data fork of the file you specify in its "-o" option. With a Rez "read" statement you can read the PEF container and move it into the resource fork of an intermediate file (BDef.rsrc):

read 'pCod' (128) "my.pef";

The final $$Resource ("BDef.rsrc", 'pCod', 128), then reads that resource back in.

Q In MixedMode.r, it gives an example of using a 'sdes' such as:

type 'BDef' as 'sdes';

resource 'BDef' (1) { 
$1,     // 68k ProcInfo 
$1,     // PPC ProcInfo

What is the definition of ProcInfo??

A ProcInfo describes the parameters and result values of your routine. Using the description of what exactly the "fields" are in this 32 bit value, you should be able to figure out the hex value. This has to be filled in for both the 68K and PowerPC versions. Since both are identical (= have the same prototype), the same value has to be used.

Q In my 68K code resource, I use:

RememberA0(); SetUpA4(); RememberA4();

The note in 'sdes' says that this can't be used currently for resources containing code with register-based calling conventions.

Will this affect me? Can I simply use different registers to circumvent this conflict? If this does affect me, how do you build a code resource without using the Remember and SetUp functions?

A The 'sdes' resource starts with some 68K code preamble that determines if MixedMode is available. This code thrashes D0, A0, and A1, so you can't use these registers to pass parameters. Note that A4 is not touched in the preamble.

Technical Q&As
Previous Question | Contents | Next Question