Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: A 68K assembler question  (Read 732 times)

0 Members and 1 Guest are viewing this topic.

Offline Karlos

A 68K assembler question
« 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?
int p; // A
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
  • Total likes: 0
    • http://www.iki.fi/sintonen/
Re: A 68K assembler question
« Reply #1 on: September 28, 2005, 03:21:10 PM »
It sure is allowed with proper compilers (for example GenAm from DevPac).
 

Offline Karlos

Re: A 68K assembler question
« Reply #2 on: September 28, 2005, 03:23:44 PM »
Any idea about phxass?
int p; // A
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
  • Total likes: 0
    • http://www.iki.fi/sintonen/
Re: A 68K assembler question
« Reply #3 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.
 

Offline darkcoder

Re: A 68K assembler question
« Reply #4 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
The Dark Coder / Trinity
 

Offline Karlos

Re: A 68K assembler question
« Reply #5 on: September 28, 2005, 04:01:30 PM »
Good stuff, that's just what I wanted to know.
int p; // A