04 July 2017, 19:37 | #61 |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Absolutely!
I've actually gone from what I'd consider the 'easiest' way, ie crosscompiling from C/++ on a PC, to what is possibly the hardest way, ie doing it in assembler (AsmPro) on real hardware. I'm not exactly sure how that transition came about; I'm kind of weird that way.. And although I do enjoy the 'raw' feeling of doing it this way, checking out the PC route is definitely on my todo list. I'm doing it this way first because I had a go at assembler programming about 30 years ago, but I never got anywhere with it. So you could say that I'm trying to finally settle some unfinished business. That, and because everyone keeps telling me it's to 'only true way' to do it. Oh, and did I already mention [ Show youtube player ]? |
05 July 2017, 08:36 | #62 | |
Unregistered User
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 44
Posts: 4,190
|
Quote:
The problem is here that I do not want to spend much time setting up the environment although I know that it is usually time well spent in the end. I'd rather get into the coding stuff asap. I have a vacation coming up soon, so perhaps I will spend some time trying out some stuff and perhaps figure out whether I want to go the Vampire-way or the PC cross-compiler way. Being able to mix gcc objects with assembly stuff also sounds very useful and that also favors going the PC route. |
|
10 July 2017, 17:12 | #63 |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Link to amiga.lib in AsmPro
I'm trying to link my executable to amiga.lib. I've tried this, as suggested in the guide (although they link to a .o file, rather than a .lib file):
Code:
IncLink "work:path/to/amiga.lib" So how can I link to amiga.lib? |
10 July 2017, 18:32 | #64 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 48
Posts: 3,831
|
Last edited by Thorham; 17 April 2018 at 12:20. |
10 July 2017, 21:04 | #65 |
Unregistered User
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 44
Posts: 4,190
|
Not too bad, but still not 2560x1440 like I have on my PC.
But then I do have a 19" monitor above my PC monitor which I use for C64+Amiga, so I don't need to choose one or the other. The main issue is that the two keyboards cannot accopy the same space.. |
10 July 2017, 21:55 | #66 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
When you mention that the guide only shows linking with object files, then it may have problems with libraries. In the best case it would include all objects from that library, which is certainly not what you want. Quote:
|
||
10 July 2017, 22:12 | #67 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 721
|
|
10 July 2017, 22:25 | #68 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
I don't see how this could my solve my problem. As I understand it, 'Write Link' generates a .o/.lib file which you can then link to. I want my current/executable source to link to an existing .lib file. |
|
10 July 2017, 22:29 | #69 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
I would like to XREF the _LVO.. offsets without having to include LVOs.i -- which is pretty big, and I will only be using a very small amount of those declarations. |
|
10 July 2017, 22:47 | #70 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 721
|
Yeah, that was my gut feeling.
I think it's sort of wrong. _LVO is just a number. Nothing else. To introduce a dependency + time overhead to link against the library to eliminate the need for that number is probably the most inefficient way to tackle the problem. Also, there is another calling convention with amiga.lib You *have* to pass parameters on the stack. Let's take for example DOSLibrary/Open From the amiga.lib Code:
00000000 <_Open>: 0: 48e7 2002 moveml %d2/%a6,%sp@- 4: 2c79 0000 0000 moveal 0 <_Open>,%a6 a: 4cef 0006 000c moveml %sp@(12),%d1-%d2 10: 4eae ffe2 jsr %a6@(-30) 14: 4cdf 4004 moveml %sp@+,%d2/%a6 18: 4e75 rts So, you'd have to pass parameters on stack (forget d1, d2 as the autodocs say), assuming you know what the order of parameters is on stack (it's from right to left btw). Then you link with amiga.lib And then the amiga.lib's code, pulls your parameters from stack and feeds d1 and d2 as the autodocs say. (Btw, that -30 is _LVOOpen) For all the above reasons, linking with amiga.lib when you write in assembly just to call OS functions is less than efficient. |
10 July 2017, 23:07 | #71 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 721
|
Hmm, got carried away and talked about the C stubs a bit there
Ok, so you just get the LVOOpen number from amiga.lib, the gist of my previous post still stands though. On the link you referenced me, Thorham gave you a single include file with all the LVOs. Use that. No linking. |
10 July 2017, 23:07 | #72 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
Code:
_LVOOpenLibrary equ -552 _LVOCloseLibrary equ -414 |
|
10 July 2017, 23:18 | #73 |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
|
11 July 2017, 11:51 | #74 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
I have read the documentation and made some experiments now. This INCLINK directive is very simplistic. It is not only restricted to a single object file, but also to a single section. It doesn't help you in any way. Quote:
You cannot link executables or source texts. Only object files. Assemble your current source with AsmPro. Then write the object file with "wl", for example as "main.o". Finally link it against amiga.lib: Code:
vlink -bamigahunk -nostdlib -o myprog main.o -LAmigalibPath -lamiga |
||
11 July 2017, 12:44 | #75 | ||
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
Quote:
1. What's the difference (if any) between a .o file and a .lib file? Can I make my own .lib files? When would I want to do that? 2. I'm assuming (as I've seen it) you can link several .o files together in 1 go. How does the linker know where the main entry-point is? |
||
12 July 2017, 00:09 | #76 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
A static linker library (usually with .lib or .a suffix) is a collection of multiple object files. The linker will include an object module from such a library in the linking process, as soon as one of its symbol definitions was referenced from already included code. There are also dynamic link libraries (for example with .so or .dll suffix), which are more or less a big object file which is loaded/mapped into memory and dynamically linked with the executable at run-time. Here the linker just checks if referenced symbols exist, and notes the needed dynamic library names and search-paths in the executable. On the Amiga these libraries only exist in AmigaOS4.1. Some linkers (for example GNU-ld and vlink) also support section garbage collection, which has the effect that those sections from an object file, without any references on it, are removed. So even an object file is not that indivisable anymore. Quote:
There are different types and formats of libraries. On AmigaDOS/68k the typical linker library is just a series of hunk-format object files, joined together. For example: Code:
join obj1.o obj2.o obj3.o as my.lib Quote:
The main entry point either depends on the OS or the object file format. We are talking here about AmigaOS/68k, using hunk format. In this case the OS always enters the executable at the first word of the first section. So you have to make sure that the first section of the first object file on the command line contains your startup code. The linker cannot help you here. Other formats, like ELF, can define an entry point in the header, and you can set it with linker options or in a linker script. |
|||
12 July 2017, 12:40 | #77 |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Thanks a lot for taking the time to explain this, phx, I really appreciate this!
|
12 July 2017, 13:09 | #78 |
Unregistered User
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 44
Posts: 4,190
|
Yes, very clear and understandable explanation.
|
04 August 2017, 15:35 | #79 | |
Unregistered User
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 44
Posts: 4,190
|
Quote:
Haven't tried whether it wants to run on the Vampire. Bdebug seemed to start, although I haven't tried using it yet. Currently I started trying out some stuff with Asm-Pro and have gone through most of Photon's lovely tutorial videos. What I could really use, are some reference manuals in book-form as I can't recite all the addresses from memory like some of you might be able to. Those books are not too easy/cheap to get a hold of unfortunately. Any suggestions in regards to some memory maps / custom chip register lists that are designed for A4 print outs? |
|
04 August 2017, 16:39 | #80 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
And print it. The HRM is all you need for Amiga hardware programming. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AsmOne installation | lunecat | Coders. General | 1 | 19 September 2015 00:05 |
Linker to use with AsmOne (68000) | nandius_c | Coders. Asm / Hardware | 10 | 10 December 2014 11:53 |
Playing around with AsmOne on Winuae.. | jimmy2x2x | Coders. Asm / Hardware | 13 | 18 November 2014 18:22 |
AsmOne: Undefined symbol | copse | Coders. Asm / Hardware | 2 | 02 April 2012 01:41 |
AsmOne even directive...? | pmc | Coders. General | 30 | 04 December 2009 09:33 |
|
|