Thread: Simple Question
View Single Post
Old 09 January 2009, 00:41   #10
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Ed Cruse View Post
Maybe I'm missing something here
you do

Quote:
but you can use absolute addressing all you want with the Amiga OS. You shouldn't use specific addresseses unless you are talking to the hardware registers. The following lines of code work perfectly fine anywhere in memory.

movea.l #addlabel,a0 also lea addlabel,a0.
while that code is of course perfectly ok, it's not what the thread opener asked about:
Quote:
Originally Posted by bpazolli
This book suggests that you place all your data used by your program at memory address $6000 and the actual program at $7000 (or something like that).
He asked if it is ok to use absolute (or fixed) addresses and something like
lea $7000.w,a0 WON'T be converted to an offset when you use org/load directives, i.e. assemble your program to fixed memory locations!

Quote:
You should however always use absolute addressing when referencing a label in another section, the sections can be loaded anywhere in memory with respect to each other, therefore they can be out of 16bit range from each other.
That's not quite correct either, it is perfectly possible to reach offsets larger than 16 bit (e.g. a different SECTION) WITHOUT using absolute addressing. There's actually NO reason to have any RELOC32 entry in any program. So saying that you should always use absolute addressing when you need to access a label in another section is simply wrong.

Quote:
In other words, if you want to use absolute addressing, do it and don't worry about it.
While there's nothing wrong with it, there ARE reasons why you need to worry about it (sometimes size DOES matter, you know ;D) I for myself HATE non-relocatable code and try to avoid it whenever I can.
StingRay is offline  
 
Page generated in 0.04513 seconds with 11 queries