Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Karlos on September 28, 2005, 03:12:44 PM

Title: A 68K assembler question
Post 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?
Title: Re: A 68K assembler question
Post by: Piru on September 28, 2005, 03:21:10 PM
It sure is allowed with proper compilers (for example GenAm from DevPac).
Title: Re: A 68K assembler question
Post by: Karlos on September 28, 2005, 03:23:44 PM
Any idea about phxass?
Title: Re: A 68K assembler question
Post by: Piru on September 28, 2005, 03:29:31 PM
Works with PhxAss.

PhxAss does have some limitations for the expressions allowed though, but simple stuff like this works just fine.
Title: Re: A 68K assembler question
Post by: darkcoder on September 28, 2005, 03:29:41 PM
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
Title: Re: A 68K assembler question
Post by: Karlos on September 28, 2005, 04:01:30 PM
Good stuff, that's just what I wanted to know.