flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Why .if == doesn't work but .if = works?

Author
Thread Post new topic Reply to topic
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker 10 Dec 2020, 03:20
Hi,

Why the following does not compile?

Code:
.if eax == 2
    NOP
  .else
    NOP
  .endif    


Quote:

c:\fasm\include/macro/if.inc [12] .if [7]:
JNCOND __ELSE,arg
c:\fasm\include/macro/if.inc [98] JNCOND [9]:
match cond,parsed@cond \\{ JNCONDEXPR label,cond \\}
c:\fasm\include/macro/if.inc [98] match [2]:
match cond,parsed@cond \\{ JNCONDEXPR label,cond \\}
c:\fasm\include/macro/if.inc [98] match [0]:
match cond,parsed@cond \\{ JNCONDEXPR label,cond \\}
c:\fasm\include/macro/if.inc [195] JNCONDEXPR [8]:
match ,mod \\\{ JNCONDEL elabel,<cond> \\\}
c:\fasm\include/macro/if.inc [195] match [1]:
match ,mod \\\{ JNCONDEL elabel,<cond> \\\}
c:\fasm\include/macro/if.inc [195] match [0]:
match ,mod \\\{ JNCONDEL elabel,<cond> \\\}
c:\fasm\include/macro/if.inc [307] JNCONDEL [40]:
cmp v1,v2
c:\fasm\include/macro/if.inc [307] match [27]:
cmp v1,v2
c:\fasm\include/macro/if.inc [307] match [1]:
cmp v1,v2
processed: cmp eax,=2
error: invalid operand.





The same one with a single "=" works

Code:
.if eax = 2
    NOP
  .else
    NOP
  .endif    
Post 10 Dec 2020, 03:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20632
Location: In your JS exploiting you and your system
revolution 10 Dec 2020, 03:55
The macro is only designed to use one equals.

This is not C, Python, etc., so using two equals won't work.
Post 10 Dec 2020, 03:55
View user's profile Send private message Visit poster's website Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker 10 Dec 2020, 05:17
Great, thanks revolution. I was confused because in MASM it is double equal.
Post 10 Dec 2020, 05:17
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.