flat assembler
Message board for the users of flat assembler.

Index > Main > Confused about FASM macro specifics.

Author
Thread Post new topic Reply to topic
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder
I would like to know how and when is the best time to use "common", "reverse" and "forward" within a macro. These are Fasm-specific constructs and I am not exactly sure how they work. I have read the FASM PDF manual straight through and it did not seem to explain these in a way in which I would understand. Also, I have looked at various macros which use these constructs and I still cannot understand how they are exactly working. I think everything else about fasm seems pretty self-explanatory to me, except for this one thing.

In other words, the manual did not allow me to understand and neither does looking at raw code that uses it.

Would somebody please post some very simple code which uses those which is commented well, explaining how and when they should be used and why?

Thanks!
Post 07 May 2004, 04:20
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Code:
macro foo [values] {
    common
        db values
        db "$"
}
foo 1,2,3    

this will generate: 1,2,3,"$"

but if you have:
Code:
macro foo [values] {
    forward
        db values
        db "$"
}
foo 1,2,3    

this will generate: 1,"$",2,"$",3,"$"

reverse works similarly:

but if you have:
Code:
macro foo [values] {
    reverse
        db values
        db "$"
}
foo 1,2,3    

this will generate: 3,"$",2,"$",1,"$"

so you can see common is processed always only once - for all values at once. but forward and reverse blocks are processed individually for each element in comma-separated parameter

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 07 May 2004, 04:30
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder
THANK YOU! That was most useful and an absolutely excellent explanation!
Post 07 May 2004, 04:34
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 YouTube, Twitter.

Website powered by rwasa.