flat assembler
Message board for the users of flat assembler.

Index > Main > the if macro/instruction

Author
Thread Post new topic Reply to topic
hyperzap



Joined: 22 Apr 2011
Posts: 4
hyperzap
hi,

i have seen where people have written assembly like:

.if eax==2
inc eax
.endif

is this possible in FASM? if yes, how complex may the conditional expressions become? is this the correct syntax for the preprocessor?

thanks, hyperzap
Post 15 May 2012, 05:02
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Yes it's valid. It's more of a high-level syntax. But FASM will generate an appropriate J/MP/NE/S etc opcode.
Post 15 May 2012, 05:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17467
Location: In your JS exploiting you and your system
revolution
hyperzap: See the documentation about these extensions macros:

http://flatassembler.net/docs.php?article=win32#2.2
Post 15 May 2012, 05:32
View user's profile Send private message Visit poster's website Reply with quote
hyperzap



Joined: 22 Apr 2011
Posts: 4
hyperzap
thanks. i didn't see that.

/solved.
Post 15 May 2012, 05:40
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1413
Location: Toronto, Canada
AsmGuru62
It is better to avoid a jump in this case:
Code:
xor    ecx, ecx
cmp eax, 2
sete  cl
add       eax, ecx
    

That is if you do not need ECX.
Smile

Yeah... I am not in love with these IF (spaggheti-making) macros.
Post 15 May 2012, 12:51
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Quote:
Yeah... I am not in love with these IF (spaggheti-making) macros.


Me too. IMHO, these HLL style macros make asm programming unclear and not readable.
Post 15 May 2012, 13:26
View user's profile Send private message Visit poster's website ICQ Number 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 YouTube, Twitter.

Website powered by rwasa.