flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [fasmg] Why does this not work?

Author
Thread Post new topic Reply to topic
_shura



Joined: 22 May 2015
Posts: 61
_shura 12 Aug 2017, 00:02
Ohai,
this
Code:
foo equ bar
a_#foo#_b = '#'
display a_bar_b
    

fails with
Quote:

Error: symbol 'a_bar_b' is undefined or out of scope.

Is there a way to get it compile,except for
Code:
foo equ bar
match any, foo
  a_#any#_b = '#'
end match
display a_bar_b
    

?
Post 12 Aug 2017, 00:02
View user's profile Send private message Visit poster's website Reply with quote
jacobly



Joined: 04 Feb 2016
Posts: 44
jacobly 12 Aug 2017, 05:44
The symbolic variable would only be substituted if the entire identifier (a_foo_b in this case) matched the variable name. Parameter variables, however, get replaced first, and match is the simplest way to create one. Another way which would work is:
Code:
foo equ bar
a_bar_b = '#'
match symbol, foo
    a_foo_b equ a_#symbol#_b
end match
display a_foo_b    
Post 12 Aug 2017, 05:44
View user's profile Send private message 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.