Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Karlos on September 28, 2005, 03:12:44 PM
-
Hi,
I'm at work at the moment so I cant really test this or spend too long looking it up.
Does anybody know if it is possible to subtract label addresses in expressions for 68k asm in order to get an address as an offset from another?
Imagine:
_base
_label_1
; stuff
_label_2
; more stuff
....
_label_n
; last entry, not more than 32KB from _base
_offsetTable
; table consists of 16-bit offsets of each code section as measured from _base
dc.w (_label_1 - _base), (_label_2 - _base), ..... , (_label_n - _base)
Is this allowed?
-
It sure is allowed with proper compilers (for example GenAm from DevPac).
-
Any idea about phxass?
-
Works with PhxAss.
PhxAss does have some limitations for the expressions allowed though, but simple stuff like this works just fine.
-
I guess it should be allowed. I think to remember that ASM-One and maybe other assemblers have a special directive just for this purpose, called DR...
The dc.X (Label1-base),(label2-base) solution you wrote should be the most general one
-
Good stuff, that's just what I wanted to know.