[comp.sys.amiga] AmigaDOS Hunks

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (03/05/89)

In article <92203@sun.uucp> cmcmanis@sun.UUCP (Chuck McManis) writes:
>(which sometimes you can just execute myprog.o if there are no externals
>at all) 
>
	I've been wondering about this recently.  From some experiments I've
been running lately, it seems as though LoadSeg() will only load files that
start with HUNK_HEADER (0x3F3).  Is this true?  If not, what will LoadSeg()
accept?  Are LoadSeg() and the program loader synonymous i.e. will LoadSeg()
properly load and relocate a file that the CLI would otherwise report as not
an object file?

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	INET: well!ewhac@ucbvax.Berkeley.EDU
 \_ -_		Recumbent Bikes:	UUCP: pacbell > !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor

cg@myrias.UUCP (Chris Gray) (03/07/89)

In article <10895@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>	I've been wondering about this recently.  From some experiments I've
>been running lately, it seems as though LoadSeg() will only load files that
>start with HUNK_HEADER (0x3F3).  Is this true?  If not, what will LoadSeg()
>accept?  Are LoadSeg() and the program loader synonymous i.e. will LoadSeg()
>properly load and relocate a file that the CLI would otherwise report as not
>an object file?

I think it may be even more obscure than that. I've been working, off and on
over the last few years, on a game system which starts out by using LoadSeg
to load some scenario-specific code (written in Draco of course!). Because of
the special situation, that code doesn't need to be linked with any normal
startup code. LoadSeg kept refusing to load it. I ended up having to have a
dummy startup which did a JMP to the actual entry point. The funny thing is
that the hack wasn't needed when the scenario code was compiled with my old
Draco compiler. If you ever find out the real rules for makeing LoadSeg
accept a file, please let me know.

-- 
Chris Gray		Myrias Research, Edmonton	+1 403 428 1616
	{uunet!mnetor,ubc-vision,watmath,vax135}!alberta!myrias!cg

jesup@cbmvax.UUCP (Randell Jesup) (03/07/89)

In article <10895@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>	I've been wondering about this recently.  From some experiments I've
>been running lately, it seems as though LoadSeg() will only load files that
>start with HUNK_HEADER (0x3F3).  Is this true?  If not, what will LoadSeg()
>accept?  Are LoadSeg() and the program loader synonymous i.e. will LoadSeg()
>properly load and relocate a file that the CLI would otherwise report as not
>an object file?

	Yes, for a program to be loaded by LoadSeg(), it must start with a
HUNK_HEADER.  CLI (and everything else) use LoadSeg().

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup

cmcmanis%pepper@Sun.COM (Chuck McManis) (03/07/89)

In article <10895@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>	I've been wondering about this recently.  From some experiments I've
>been running lately, it seems as though LoadSeg() will only load files that
>start with HUNK_HEADER (0x3F3).  Is this true?  

Seems to be. The MetaCompCo assembler would put this as the first hunk so
that you could run your assemblies directly. I've since found that Lattice
doesn't do this so you have to at least have the token
1> Blink x.o to x
Before it will run your executable. See the sample program in my response
to "Compiling with no startup module"


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

limonce@pilot.njin.net (Tom Limoncelli) (03/07/89)

Here's a good chance to show off what should be in comp.sys.amiga and
what should be in comp.sys.amiga.tech.  Since this article was talking
about the format of an executable, it belongs in comp.sys.amiga.tech.
If it was about cute Amiga programmers, then it should go to comp.sys.amiga.

-Tom
-- 
 Tom Limoncelli -- tlimonce@drunivac.Bitnet -- limonce@pilot.njin.net
            Drew University -- Madison, NJ -- 201-408-5389
Standard
Disclaim
er.

jesup@cbmvax.UUCP (Randell Jesup) (03/09/89)

In article <927@myrias.UUCP> cg@myrias.UUCP (Chris Gray) writes:
>I think it may be even more obscure than that. I've been working, off and on
>over the last few years, on a game system which starts out by using LoadSeg
>to load some scenario-specific code (written in Draco of course!). Because of
>the special situation, that code doesn't need to be linked with any normal
>startup code. LoadSeg kept refusing to load it. I ended up having to have a
>dummy startup which did a JMP to the actual entry point. The funny thing is
>that the hack wasn't needed when the scenario code was compiled with my old
>Draco compiler. If you ever find out the real rules for makeing LoadSeg
>accept a file, please let me know.

	LoadSeg() will not load an object module, even if there are no external
references in it.  Object modules do not have HUNK_HEADER hunks at their start,
telling LoadSeg() what's coming.  In order to make an object module loadable,
just alink or blink it (FROM foo.o TO foo), which will add the HUNK_HEADER
(and check for unresolved references).

	Followups are directed to .tech

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup