flat assembler
Message board for the users of flat assembler.

Index > Windows > [Question]Before I start my first assembly project

Author
Thread Post new topic Reply to topic
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg
I want to rewrite my c++ gcc bloatware app into a small PE.

But I don't understand how some fasm features work even though I read the documentation(which is a little poorly explained for newbies).

I just want to know exactly how the interpreter will handle my code.
I'm only interested in the PE format atm:

- I saw in the example project "beer" that sections are automatically created by fasm if not found. Are there other things done by fasm if you don't specify? Could you tell me all of those things? Should I bother writing these into my code or let fasm handle it?

- Section names. .data .text .idata .rsrc ect. What is .idata? When are they needed in my code? What is a .flat section? Can I make my own section names?

- win32a.inc win32ax.inc win32axp.inc -> Why are there 3 of them? Is there any reason not to use win32axp.inc? Practical difference between them?

- Any order requirements in fasm? Can I mix up code and data without any compiling problems?

- Thanks:) A good answer will help me so much!
Post 20 Aug 2011, 22:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
1. If no section is specified, FASM creates single section (not sections). This makes life little bit easier for those who don't really understand how PE section works, otherwise it is seldom needed and it could even be suspicious to some AV heuristics. IMO it is better to stick to usual PE sections layout.

2. Name of section (those 8 characters) doesn't really matter, it is just convention. What matters are flags, such as "readable", "executable", "writeable", "code", "data" or directory specifiers ("import", "export", "fixups", ...). ".idata" is conventional name for "initialized data" section. ".flat" is name FASM uses for all-purpose section that it creates if programmer doesn't specify anything.

However if you are speaking about ".data", ".code" directives, those are in fact a macro, a higher level abstraction built upon FASM's native directive "section". This directive is described in manual.

3. Did you find http://flatassembler.net/docs.php?article=win32 ? You don't always want things like parameter counting, also it probably wastes few MBs more during compilation.

4. Unlike MASM, FASM is a very low-level assembler. Mixing code and data doesn't cause any compilation problems I can imagine. However I don't see practical reason to do that.
Post 20 Aug 2011, 23:36
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rohagymeg



Joined: 19 Aug 2011
Posts: 77
rohagymeg
Thank you for answering! Almost everything is clear!
Post 21 Aug 2011, 00:53
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.

Powered by rwasa.