flat assembler
Message board for the users of flat assembler.

Index > Main > How to use relativeto in fasmg?

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 674
l4m2 15 Aug 2016, 10:37
Code:
a equ 12
b equ 12 + x
if a relativeto x
  display 'Hi'
end if    

If x is not defined, it says
fasmg wrote:
Error: symbol 'x' is undefined or out of scope.

Code:
a equ 12 * x
b equ 12 + x
x=0
if a relativeto x
  display 'Hi'
end if    

If x is defined, it displays, regardless of whether x-a is a constant.
Post 15 Aug 2016, 10:37
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 15 Aug 2016, 11:46
This works the same as in fasm - if you assemble the above samples with fasm 1.71, you're going to get the same results.

The only difference is that in fasm "relativeto" can only be used to check if expression is relative to one of the addressing symbols pre-defined by the assembler (like "if a relativeto ebx"), while in fasmg you freely define such symbols yourself, with "element" directive:
Code:
element x
a equ 12
b equ 12 + x 

if a relativeto x
  display 'a'
end if

if b relativeto x
  display 'b'
end if    
Post 15 Aug 2016, 11:46
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.