flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Do you use FASM's High level macros?

Goto page 1, 2  Next

Do you use FASM's high level macros?
Yes, sometimes they make my life easier.
62%
 62%  [ 27 ]
No, I'm an ASM purist. I just use real machine instructions.
27%
 27%  [ 12 ]
Other opinion. (post it)
9%
 9%  [ 4 ]
Total Votes : 43

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
By high level macros I mean:
.if
.while
etc...

I use them, because I think structured programming is easier in most cases, but sometimes jmp is better.
I think FASM becomes easier when you use these macros, because you have the same logical thinking of C, but you don't worry about ugly casts and other things that make C less readable.
Post 11 Aug 2007, 20:50
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
I use. Sometimes. In small projects uses standart assembler commands. If project is BIG and will be uses (in future) dlls and other modules from other languehes use as much macroses as can. Time is money.
Post 12 Aug 2007, 01:00
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
I use my own set of macros, but not many existing ones (such as .if, .while, etc)
Post 12 Aug 2007, 01:46
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
A few years ago, I used to think like an assembler purist. But, once I started to learn the proc/endp/.if/.elseif/.endif/etc./ macros, I never looked back.
Post 12 Aug 2007, 10:16
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
They are definitively useful in some cases. In other cases, you can go with labels and conditional jumps just as well, or even better.

It's best to learn both, and learn when to use which.

PS: But i don't use them in FASMLIB code, even though sometimes it makes my code little "hard to follow" Smile
Post 12 Aug 2007, 14:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
i don't like when preprocessor+compiler make some invisible tricks on my asm code. So code like (c)invoke, auto prologs/epilogs and ret (if not naked) - the only i allow to preprocessor.
Post 12 Aug 2007, 15:38
View user's profile Send private message Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH
A few years ago, I used macros. But, after the 10,000th time (slight exaggeration) a macro threw some stupid error, I thought sod this, this is just like programming in C\C++, so I dumped the use of all macros and I never looked back.

Turns out you don't need macros to program as the fasm multiple passes used with virtual blocks are really powerful and the assembler time load, store, if, while, repeat etc are really all you need..... however store needs extending.

Take "include" out of the preprocessor and the preprocessor can be dumped .... I hope Tomasz does this in future releases.


Last edited by MichaelH on 13 Aug 2007, 21:14; edited 1 time in total
Post 12 Aug 2007, 23:53
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
Hmm, I answered "Yes" but actually I shouldn't have because all I use are if, while, rept and virtual, load, store, like the previous poster suggested.

Actually its a "Maybe" Very Happy because there might be some times when I use them, but usually drop in production.
Post 13 Aug 2007, 11:19
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
Using high level macros in fasm may be a good idea, but in a large projects it is not acceptable. Fasm wastes a huge amount of memory while compiling (in my case about 512k for each structure declaration, even if I don't actually using some of them in a program). As I can understand, it never releases memory after using it.
Post 13 Aug 2007, 14:15
View user's profile Send private message ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
yes, this is a disadvantage of fasm. But maybe in future versions something will change. Fasm supports more then 2 GB of RAM?
Post 13 Aug 2007, 16:48
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
I use my own and FASM pre-defined ones.
Sometime they make the code easier to read and follow. Sometimes they are useless and cumbersome and the label/jcc combination becomes handier.

@asmfan: No black magic here, just two or three lines of code. Check the macros, they are so simple and clear. 'invoke' or 'proc' generate much more 'invisible tricks' than '.if', '.else' and co.
Post 14 Aug 2007, 07:49
View user's profile Send private message Reply with quote
zxcv
Guest




zxcv
no way!
low level programming is easier, you cant do mistake (because u know what u do).

And i dont like writing anything on time.
Post 15 Dec 2007, 00:40
Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:
low level programming is easier, you cant do mistake (because u know what u do).

haha, but I saw several times that you imported DLL functions using library and import macros Smile

Programming with macros in fact is easier but sometimes makes the life harder when you try to optimize (for speed or size) and can introduce errors due to the side effects (e.g., "lea edx, [ebx+esi*4+1234]/stdcall foo, edx, addr bar" will make the LEA instruction very useless). It must be used when the task is really repetitive, not when you can arrange the things to make sub-optimal repetition.

IMHO, it is good practice to use macros and do hand replacement later, perhaps this way take you longer to produce the final code, but writing all in full low level fashion also makes you code slower because you invest time figuring out how to arrange all the stuff to keep growing your code (which many times results in that you need to modify many lines when you realize that for example you did a bad register utilization among other things).
Post 15 Dec 2007, 02:22
View user's profile Send private message Reply with quote
zxcv
Guest




zxcv
Quote:
haha, but I saw several times that you imported DLL functions using library and import macros Smile

so tell me how to import in other way.
Post 16 Dec 2007, 03:11
Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Having downloaded flat assembler for Windows, check EXAMPLES\PEDEMO\PEDEMO.ASM
Post 16 Dec 2007, 03:28
View user's profile Send private message Reply with quote
zxcv
Guest




zxcv
okay, didnt knew about that.
i can understand it but why
dd 0,0,0,RVA kernel_name,RVA kernel_table
what are tose 0,0,0 for?
Post 16 Dec 2007, 04:10
Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17464
Location: In your JS exploiting you and your system
revolution
zxcv wrote:
... what are tose 0,0,0 for?
That is part of the import table structure in the PE file. That is what the macros are doing for you, making your life easier by not having to worry about the minute details of things like file formats and OS calling standards.
Post 16 Dec 2007, 04:17
View user's profile Send private message Visit poster's website Reply with quote
zxcv
Guest




zxcv
I always liked to be on lowest possible level programming,
my goal it to understand it so much to write in hex editor Wink

i found description of pe wich im going to learn(http://kalbasa.paradoxinc.org/coding/bin/htm/pe.htm).

If you have better, please link it!
Post 16 Dec 2007, 04:49
Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
many people like to use macros like procedures in C, but as some people already pointed out they can help in many ways.

for example, imagine something like this...

INTERRUPT 10

-- new INT10 code here

ENDINTR

_________________
New User.. Hayden McKay.
Post 16 Dec 2007, 11:47
View user's profile Send private message Reply with quote
os.hacker64



Joined: 01 Mar 2008
Posts: 22
os.hacker64
zxcv wrote:
I always liked to be on lowest possible level programming,
my goal it to understand it so much to write in hex editor Wink

i found description of pe wich im going to learn(http://kalbasa.paradoxinc.org/coding/bin/htm/pe.htm).

If you have better, please link it!

Yay low level!
Post 01 Mar 2008, 14:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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.