flat assembler
Message board for the users of flat assembler.

Index > Main > Conditionals...

Author
Thread Post new topic Reply to topic
pepe



Joined: 26 Feb 2015
Posts: 19
pepe 04 Jul 2015, 10:18
Hello,

I have the following code which works kindof not as i expected:
Code:
Ver equ bbb

if Ver eq aaa
   x equ a
   display "aaa"
else if Ver eq bbb
   x equ b
   display "bbb"
else if Ver eq ccc
   x equ c
   display "ccc"
end if

display x           


As i would expect, the second block is compiled, so "bbb" is displayed in the message window, but the 'display x' line compiles as 'display c' instead of 'display b'.
Actually, it seems the value of Ver does not impact the value of x, x equ c is always what gets compiled Shocked

Moreover i get an error for the last display command, which i could live with, but would be nice to know how to display numerical values like this:
Code:
a equ 0x1234
display a
    


thanks again,
pepe
Post 04 Jul 2015, 10:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20489
Location: In your JS exploiting you and your system
revolution 04 Jul 2015, 13:26
The if, else and end if are assembler blocks. Using equ is a preprocessor block. The preprocessor ignores the if/else/end if and always executes the equ. To make the preprocessor conditional you can use match.
Post 04 Jul 2015, 13:26
View user's profile Send private message Visit poster's website Reply with quote
pepe



Joined: 26 Feb 2015
Posts: 19
pepe 07 Jul 2015, 07:40
Thank you. That explains everything.
In the meantime i found the answer to the 2nd question in the manual, dunno how i overlooked that.
BTW, i think it would be good to keep the log window displayed at end of compilation to see the displayed messages. If there is no error, it disappears, so i have no idea about the output of the display lines. (using FASMWARM)

pepe
Post 07 Jul 2015, 07:40
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.