flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > "Match" works inside false "if". Why?

Author
Thread Post new topic Reply to topic
Alexey2005



Joined: 14 Dec 2006
Posts: 1
Location: Russia, Krasnodar
Alexey2005
When I execute this program:
Code:
use32
macro exp arg                
 {  match comment=:value, arg \{
     display value
    \}
 }

macro loc arg {
  local ..name
  match name==val,arg \{
   ..name dd ?
   name equ ..name+INCOOP_PUSHDELTA
  \}
  if INCOOP_PUSHDELTA<>0
   match nme sttype,arg \{
    nme equ ..name+INCOOP_PUSHDELTA
   \}
  end if
}

INCOOP_PUSHDELTA=0

loc a=10
exp zz:[a]    

"display" gives out:
[.. name? 0000000+INCOOP_PUSHDELTA+INCOOP_PUSHDELTA]
(I know, that "display" in this form will produce an error - but I need to see the value of "value").
I considered, that if INCOOP_PUSHDELTA=0 then "if" was not carried out, and value must be equal
"[.. name? 0000000+INCOOP_PUSHDELTA]".
But, if the block "if" to lead to a kind
Code:
if INCOOP_PUSHDELTA <> 0
    nme equ.. name+INCOOP_PUSHDELTA
end if    

than all works as it is necessary!
How it turns out, that "match" works even inside false "if"?
Post 14 Dec 2006, 10:45
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
MATCH is the directive of preprocessor, IF is the directive of the assembler - these are two separate things.

See note near the end of the section 2.3.7 of manual. Also Understanding fasm is a recommended reading (I hope to finish it some day...) Wink
Post 14 Dec 2006, 10:55
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
PS. I forgot to also mention the answer to 4th question in FAQ, which is somehow related.
Post 14 Dec 2006, 11:04
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.