[comp.sys.mac.programmer] CODE 0 resource

jjoshua@remus.rutgers.edu (J. Joshua) (08/11/90)

Could someone please give me the layout of a CODE 0 resource?  Do the
first few bytes mean anything or is the whole thing just one big jump
table?

JOn.
-- 
 ________
|        |      This Messsage             A Service By:
|        |     Closed Captioned                 Jon Joshua
|        |  For the Hearing Impaired            jjoshua@remus.rutgers.edu
`----. .-'
     |/                 #include <whittyComment.h>   

stevec@Apple.COM (Steve Christensen) (08/13/90)

In article <Aug.11.01.18.24.1990.26676@remus.rutgers.edu> J. Joshua writes:
>Could someone please give me the layout of a CODE 0 resource?  Do the
>first few bytes mean anything or is the whole thing just one big jump
>table?

According to the Segment Loader chapter of Inside Mac, volume II:

	4 bytes		"above A5" size in bytes from where A5 points to
			the top of the application space
	4 bytes		"below A5" size in bytes of application globals
			plus QuickDraw globals
	4 bytes		length of jump table
	4 bytes		offset to jump table relative to A5
	n bytes		jump table (list of 8 byte entries)

An entry in the jump table will be in one of two states depending on if
its segment is loaded or not:

"unloaded"
	2 bytes		routine's offset relative to the start of the segment
	4 bytes		MOVE.W #segmentNumber,-(SP)  instruction
	2 bytes		_LoadSeg trap ($A9F0)

"loaded"
	2 bytes		segment number
	6 bytes		JMP routine'sAbsoluteAddress  instruction


steve

-- 
____________________________________________________________________

  Steve Christensen             Internet:   stevec@goofy.apple.com
  Apple Computer, Inc.          AppleLink:  STEVEC
  20525 Mariani Ave, MS 81-CS   CompuServe: 76174,1712
  Cupertino, CA  95014

  "You just contradicted me."  "No I didn't."
____________________________________________________________________