[comp.sys.amiga] Linking.

billk@pnet01.CTS.COM (Bill Kelly) (03/18/87)

Hi.  I have written an assembly-language program for the Amiga that strips the
characters out of files that Ed calls 'binary' and complains about.

I need to link my program with AStartup.obj as well as some library routines. 
I believe I've used the correct XREFs and XDEFs, but maybe not.  I am doing an
XDEF _main so that the startup code can jump to my program, but when I
disassembled my code (after linking), although the startup code was there, it
was not getting called at all.  My program was the first thing to be executecd
and my code makes no reference to startup. I thought startup was supposed to
be in there first and then jump to my program! 

Can anyone tell me what XDEFs and XREFs I need to have to do this correctly?
Also, where does AStartup.obj go when you are linking? As a FROM file or as a
LIBRARY file?  (I tried it both ways, ans it didn't seem to make any
difference.)

Another thing:  When I disassembled my program, I noticed that the startup
code was doing something really nice.  It made all of it's symbols visible to
the debugger.  The debugger shoewed me, in the disassembley, where all of the
startup code's labels were and even named the variables it referenced and the
strings it used.  What I'm wondering is this: How can I make the code that I
assemble do that??? (I am using the Metacomo 68000 assembler)  Being able to
see all my symbols when I am debugging would be very handy indeed!

Thanks, 
Bill Kelly      {akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner CATS) (03/19/87)

In article <915@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:
>
>I need to link my program with AStartup.obj as well as some library routines. 
>I believe I've used the correct XREFs and XDEFs, but maybe not.  I am doing an
>XDEF _main so that the startup code can jump to my program, but when I
>disassembled my code (after linking), although the startup code was there, it
>was not getting called at all. 

   The startup code must be the first file in your link.  The system
just starts executing at the beginning of your executable.  So you
must place the startup code first for it to be the entry point.

Alink FROM Astartup.obj, yourcode.o TO yourcode LIBRARY Amiga.lb

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=