English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 06 December 2002, 01:01   #1
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Angry Devpac Linking Problems

Calling all knowledgable Amiga Assembler coders. I'm having a big (annoying) problem with Devpac and linking files. Basically I've got these external reference instructions:

XREF _AbsExecBase
XREF _LVOOpenLibrary
XREF _LVODisplayBeep
XREF _LVOCloseLibrary

I've setup Devpac in the options to write the object file to disk (which it does) and also set the option to make the file linkable. It all Assembles fine but when I manage to get into the debugger (MonAm) then all hell breaks lose. Well actually I just get this error:

Error 212
In the Devpac manual it says this about Error 212:
object not of required type (such as directory name instead of file)

Do I have to use this Blink tool to link the object file to the source? I tried this and it creates an executable file but it still comes up with that error when I try to debug the damn thing.
Anyone know what I'm talking about? I'm using version 3.18 of Devpac by the way. Hope someone can help.
Steve is offline  
Old 06 December 2002, 02:36   #2
rgen
Registered User
 
rgen's Avatar
 
Join Date: Mar 2002
Location: Aachen/Germany
Age: 46
Posts: 190
Send a message via ICQ to rgen
Seems you produce an object file which must be linked first, instead of an executable file. Try to link it with amiga.lib. If you don't know which format you have, enter "type <filename> hex" in a shell, if it starts with 000003e7 its an object file, if it starts with 000003f3 its an executable file.
rgen is offline  
Old 06 December 2002, 13:52   #3
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Quote:
Originally posted by rgen
Seems you produce an object file which must be linked first, instead of an executable file. Try to link it with amiga.lib. If you don't know which format you have, enter "type <filename> hex" in a shell, if it starts with 000003e7 its an object file, if it starts with 000003f3 its an executable file.
When I compile my .s file with the "Linkable" option turned on and set Devpac to write to disk it assembles fine without a problem. You're right it does produce a .o object file. How are you supposed to link it all togther? I tried Blink like this from the shell:

Blink Source.o to Source library amiga.lib

It seems to work and creates an executable file called Source. So now I have my Source.s file and a Source.o file and a Source executable file. What am I supposed to do with the executable file? I want to run the program in the debugger MonAm without the annoying error stopping the program. I suspect I have to setup another option in Devpac but I'm not sure. Any ideas?
Steve is offline  
Old 06 December 2002, 20:18   #4
rgen
Registered User
 
rgen's Avatar
 
Join Date: Mar 2002
Location: Aachen/Germany
Age: 46
Posts: 190
Send a message via ICQ to rgen
I had a closer look to Devpac 3.18 and it worked for me without a problem. I used phxlnk as I only have the first disk. Runs the program in a shell ? Also use Snoopdos to look if monam misses something. Try to use monam with another program, maybe the monam.libfile is corrupt. If you still have problems mail the source and I will try to assemble it.
rgen is offline  
Old 07 December 2002, 11:58   #5
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Smile We're getting there...

Thanks for your help rgen. I hope I'm getting close to a solution. I've uploaded my source code and object files to the zone so you can take a look at it and see if it works. I've also included some other goodies like the MonAm libfile (I don't think it's corrupt) and also my amiga.lib file, a linker script I use and the Blink linker itself. I have a few questions about linking though.

Do you need to link a file to be able to debug it? I run the debugger from the Devpac menu and not seperately. I just select Assemble and then Debug. I tried SnoopDos and the Debugger seems to fail when it trys to read the .o file.

Do you run MonAm seperately and specify the executable to debug?

Are there any special Assembler options you set in Devpac?

The ultimate goal of all this is so I can just simply step through my program code to make sure it works. That's all I want to be able to do but it doesn't seem to let me. The program I'm running is only a small thing that opens a library then flashes the screen and closes the library again. It worked fine when I was just creating a single executable program to RAM. I did try running MonAm seperately and then telling it where to find the executable. That seemed to work but it's not really ideal. I like to see the source code and comments in the bottom window while I'm stepping through code. Anyway let me know how you get on with my code. Thanks again.

Last edited by Steve; 07 December 2002 at 12:04.
Steve is offline  
Old 07 December 2002, 20:58   #6
rgen
Registered User
 
rgen's Avatar
 
Join Date: Mar 2002
Location: Aachen/Germany
Age: 46
Posts: 190
Send a message via ICQ to rgen
Hi Steve, the solution is simple. If you run Monam separately the source code file must be in the same directory that the executable is in.
Your second question: Linking is not necessary to produce a debugable file. Linking is only needed to link a program with external sub routines or to get values from external files which is the case here. The XREF and XTERNLIB says that the values for AbsExecBase and the library offsets are in an external file. So devpac produces an object file *.o and later blink adds the needed information from amiga.lib. So monam can not use this files as it simply doesn't know this values. To remove this dependency you have to remove these external references and fill in the needed information in the source file. Replace "XREF _AbsExecBase" by "_AbsExecBase = 4". Produce some library include files (at least exec and intuition for this example) with FDToLVO from the *.fd files, remove the EXTERN_LIB lines and include the new created exec and intuition files. Then you have a standalone program which you can assemble and debug in devpac.
It's a good idea to always use the files produced by FDToLVO as this saves a lot of typing.
rgen is offline  
Old 08 December 2002, 12:39   #7
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Evil grin

Hmmmmm. The source and executable are in the same directory. I had already tried what you suggested by having the inlucde files and AbsExecBase =4. It did work fine and debug fine. I was just trying to see if I could get it to work using linking instead of an executable. So what you're saying is to forget linking and stick with the version that works. Ok. So are Linkable programs not debuggable using MonAm from the Devpac menu? If this is the case why would anyone want to make a linkable program if you're unable to debug it? A bit confused I am.
Steve is offline  
Old 08 December 2002, 18:29   #8
rgen
Registered User
 
rgen's Avatar
 
Join Date: Mar 2002
Location: Aachen/Germany
Age: 46
Posts: 190
Send a message via ICQ to rgen
No, it is possible to debug a linked executable, but you have to do it manually after the linking inside a CLI and not inside the devpac environment, so linking is useful if you use subroutines from other files but to write XREFs for the library offsets is more work than to simply include them.
rgen is offline  
Old 10 December 2002, 11:37   #9
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Cool Ok Cheers

Quote:
Originally posted by rgen
No, it is possible to debug a linked executable, but you have to do it manually after the linking inside a CLI and not inside the devpac environment, so linking is useful if you use subroutines from other files but to write XREFs for the library offsets is more work than to simply include them.
Ok. Thanks rgen for all your help with this little problem. I'll get back to my coding now. I've not done much on it for a week. So as I understand it you can only debug the executable of linked files and not through the Devpac assembler. This is a bit of a shame because I like to see the 4th (Source) window at the bottom of the debugger. Mainly because it has my comments next to the code. When debugging executables you have just the Disassembly window to look at. Still at least I've got my head around it now. Cheers.
Steve is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
what cable do i need for linking two amigas? trydowave support.Hardware 11 13 July 2013 14:35
Linking to HOL from the forum Ultron HOL suggestions and feedback 4 20 January 2007 04:46
Linking PC, Amiga and Mac. HardStep support.Hardware 3 01 February 2006 21:03

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:28.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10174 seconds with 13 queries