[comp.sys.amiga] Format of loadable object files

cg@myrias.UUCP (Chris Gray) (06/29/87)

As of yesterday, I finished off (hopefully) the world-creation program for
my 'Explore' D&D system. My next step is the supervisor program for running
the scenarios. For this I need to dynamically load the code for the scenario.
I managed to get it working, but ran into something that's puzzling me. It
seems that in order for the system (presumeably 'LoadSeg') to recognize a
file as a valid object file, the file has to start with a hunk with a 'jmp'
in it. I haven't done experiments to see exactly what is needed, but a file
with just a Draco routine wasn't accepted, even though BLink didn't complain
when it linked it. When I tried to run it directly, I got error number 121
(not an object file). To kludge it to work, I made the following stub:

	IDNT	"explore.startup"
	XREF	exploreEntry
	JMP	exploreEntry
	END

and BLink'ed with that object + the one I wanted, with its entry point renamed
as 'exploreEntry'. Then all was well. Has anyone figured out just what IS
needed?
-- 
Chris Gray		Myrias Research, Edmonton	+1 403 432 1616
	{seismo!mnetor,ubc-vision,watmath,vax135}!alberta!myrias!cg

andy@cbmvax.UUCP (Andy Finkel) (07/17/87)

In article <510@myrias.UUCP> cg@myrias.UUCP (Chris Gray) writes:
>It seems that in order for the system (presumeably 'LoadSeg') to recognize a
>file as a valid object file, the file has to start with a hunk with a 'jmp'
>in it.

The AmigaDOS routine that the CLI is calling to execute you is doing
a JSR to what was just LoadSeg'd.  So its best to have executable
code there.  A JMP isn't required.  For example, the printer.device
individual printer modules.

Of course, you have to start your object module with a hunk_header block.
If this is missing you'll get the "File is not an object module" error
message.  Perhaps (assuming you start with executable code) that
when you put the JMP in that forces the creation of the hunk_header ?
			andy
-- 
andy finkel		{ihnp4|seismo|allegra}!cbmvax!andy 
Commodore-Amiga, Inc.

"The goal of Computer Science is to build something that will last at
least until we've finished building it."

Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.