flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > eqtype question

Author
Thread Post new topic Reply to topic
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov 13 Mar 2006, 19:53
Hi,
Why eqtype didn't work in this case
Code:
macro foo p
{if p eqtype ''
    append p ;macro from fasm manual
 end if}

list equ
foo '555'
foo '444'
foo eax
list; result is '555','444',eax. if check p eqtype % - result is identical Confused     


thanks
Post 13 Mar 2006, 19:53
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 13 Mar 2006, 19:59
EQU is a directive of preprocessor, while IF is a directive of assembler. Thus IF cannot affect the EQU, since prepressor finishes its job even before assembler has the change to look at the source.
This problem is covered in FAQ, and also in my recent Understanding fasm article, which I write to explain those confusing things about preprocessor and assembler (though you have to wait a bit till it's finished).

The solution is to use MATCH instead, which can be frequently used as an analogue of IF for the preprocessor. In this case it may look like:
Code:
macro foo p
{ match `p,p
  \{ append p \} }    
Post 13 Mar 2006, 19:59
View user's profile Send private message Visit poster's website Reply with quote
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov 13 Mar 2006, 20:51
didn't work on fasm 1.64(unexpected characters) - i will download the new version and try it.
thanks again
Post 13 Mar 2006, 20:51
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 13 Mar 2006, 21:05
Oh, right, the ` operator was not yet as fully suppoted by 1.64 as it is by 1.65.
Post 13 Mar 2006, 21:05
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.