flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Allow complex expressions (like C)

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Hi guys,

I think that I saw it somewhere in thsi forum, but I cannot find it or maybe I was wrong. I wanted to ask if there is a way to allow complex expressions. Example:

Code:
MyProc proc 

local my_var1:DWORD, my_var2:DWORD

EBX = 0             ; instead of "mov ebx, 0"
[my_var1] = EBX  ; instead of "mov [my_var1], ebx
...

EAX = ECX + [my_var1] + EBX * 3;

MyProc endp    


I know this is like C and not ASM...but was wondering if it's possible to be done in FASM

Thanks!!!
Post 12 Nov 2010, 22:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
Please check out this tutorial on "match" directive: http://board.flatassembler.net/topic.php?p=34035#34035

As one of the examples it implements the "let" macro that allows to write things like:
Code:
let EBX = 0
let [my_var1] = EBX
let EAX += 4    
but nothing more complex. However after you read it all, you should have a general idea what can be done with fasm's preprocessor capabilities. Also IRPS directive may help a bit (look at how the complex logical expression parsing is done by the PARSECOND macro in the IF.INC package).
Post 12 Nov 2010, 22:44
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

if you wish to use complex expressions like C, use C and not assembler.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 12 Nov 2010, 23:03
View user's profile Send private message Send e-mail Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Thank guys! I will think of it.
Post 14 Nov 2010, 12:31
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.