flat assembler
Message board for the users of flat assembler.

Index > Main > FASM user manual

Author
Thread Post new topic Reply to topic
bdsatish



Joined: 07 Mar 2008
Posts: 10
bdsatish 10 Mar 2008, 09:31
Does anybody know where I can download the FASM User manual ? I saw the HTML documentation of FASM, but it's horribly outdated. I specifically want to know:

[1] How to obtain a listing of my ASM code. With NASM, i used the -l (small L) command-line switch:
>> nasm -f elf -l hello.lst hello.asm

How to do this in FASM ?

[2] I was able to debug my ASM source code in GDB (GNU debugger) once i used the "-g " option in NASM.
>> nasm -f elf -g hello.asm

But FASM doesnt know this. How can I include debug info in the executable ?
Post 10 Mar 2008, 09:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20528
Location: In your JS exploiting you and your system
revolution 10 Mar 2008, 11:07
bdsatish wrote:
Does anybody know where I can download the FASM User manual ?
The manual is included with each download.
bdsatish wrote:
[1] How to obtain a listing of my ASM code. With NASM, i used the -l (small L) command-line switch:
>> nasm -f elf -l hello.lst hello.asm

How to do this in FASM ?
You need to make changes to the source and recompile. See here. I don't know if it still works with the latest version, you may need to edit it.
bdsatish wrote:
[2] I was able to debug my ASM source code in GDB (GNU debugger) once i used the "-g " option in NASM.
>> nasm -f elf -g hello.asm

But FASM doesnt know this. How can I include debug info in the executable ?
fasm doesn't currently support symbol table exporting.
Post 10 Mar 2008, 11:07
View user's profile Send private message Visit poster's website Reply with quote
bdsatish



Joined: 07 Mar 2008
Posts: 10
bdsatish 10 Mar 2008, 11:25
Quote:

The manual is included with each download.



But is the user manual complete and self-sufficient ? I wanted some features of MASM ( if..else, proc..endproc, etc. ) but the manual doesn't describe it. I had to tediously search the forum to find it. Why not update the user manual ? I'm a newbie & find it very difficult to find what I need. The info is scattered all over the forum.

Quote:

fasm doesn't currently support symbol table exporting.


Then how do I debug/test my code? I basically want to single-step thru the ASM code and track the contents of registers.
Post 10 Mar 2008, 11:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20528
Location: In your JS exploiting you and your system
revolution 10 Mar 2008, 11:29
bdsatish wrote:
But is the user manual complete and self-sufficient ? I wanted some features of MASM ( if..else, proc..endproc, etc. ) but the manual doesn't describe it. I had to tediously search the forum to find it. Why not update the user manual ? I'm a newbie & find it very difficult to find what I need. The info is scattered all over the forum.
Yeah, there are a few things scattered around. But keep searching, because I'm pretty sure most things have been covered at some time.
bdsatish wrote:

Then how do I debug/test my code? I basically want to single-step thru the ASM code and track the contents of registers.
You can try Ollydbg
Post 10 Mar 2008, 11:29
View user's profile Send private message Visit poster's website Reply with quote
bdsatish



Joined: 07 Mar 2008
Posts: 10
bdsatish 10 Mar 2008, 11:42
Quote:

You can try Ollydbg

Ollydbg works only with Windows Sad I use Linux. Any such tool for Linux ?
Post 10 Mar 2008, 11:42
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Mar 2008, 22:01
Quote:
But is the user manual complete and self-sufficient ? I wanted some features of MASM ( if..else, proc..endproc, etc. ) but the manual doesn't describe it. I had to tediously search the forum to find it. Why not update the user manual ? I'm a newbie & find it very difficult to find what I need. The info is scattered all over the forum.

because that manual describes only FASM, not any extra macros (even not those described by tomasz). Note that tomasz only provides macros for windows, and those are mostly described in documentation part of site.
Post 10 Mar 2008, 22:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 10 Mar 2008, 22:56
bdsatish wrote:
Quote:

You can try Ollydbg

Ollydbg works only with Windows Sad I use Linux. Any such tool for Linux ?

Have FASM generate a *.o file, and then link to libc using gcc.

eg:
$ fasm myproc.asm myproc.o
$ gcc -o myproc -ggdb myproc.o

The resultant elf file will have most of your label information included, and you can use gdb to debug your program.
Post 10 Mar 2008, 22:56
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1905
DOS386 12 Mar 2008, 00:53
bdsatish wrote:
I saw the HTML documentation of FASM, but it's horribly outdated.


NO. It describes the compiler core.

Quote:
some features of MASM ( if..else, proc..endproc, etc. )


Implemented via macros, not in compiler core.

Quote:

nasm -f elf -l hello.lst hello.asm


Replace -f elf in commandline with format ELF in source. SSSO , RTFM Smile

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 12 Mar 2008, 00:53
View user's profile Send private message Reply with quote
bdsatish



Joined: 07 Mar 2008
Posts: 10
bdsatish 14 Mar 2008, 04:14
@revolution
Thanks for the FASM-listing. It now works fine.

@chewy509:
Wonderful, thanks. I'm now able to use GDB with FASM.

@DOS386:
First, thanks for your honest reply.
Quote:
NO. It describes the compiler core.

Agreed. But as an end user, I don't care how the internals of a compiler works. This is not a User Manual, but a Developer's Manual. There is hardly one complete example of how to write a simple program on Linux / Windows. By complete, i mean starting from 'format' directive till the program exit. For example, the doc doesn't explain how to generate a *.o file from *.asm, with examples. I had to figure out the hard way that: 'segment' & 'entry' directives are not allowed when creating an object file. The doc needs to say such facts.

Quote:
Implemented via macros

Macros are included in the standard Windows distribution (in 'include' directory) , but not under Linux. Does the doc highlight this fact ? No, it doesn't. Even the macros in 'include' directory lack comments. Not even a single comment. How can i understand?

Quote:
Replace -f elf in commandline with format ELF

My ques was regarding -l listing.lst and not -f elf
Post 14 Mar 2008, 04:14
View user's profile Send private message Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP 14 Mar 2008, 05:13
Quote:
Even the macros in 'include' directory lack comments. Not even a single comment. How can i understand?
Most people (after reading the FASM manual, ironically) can have a basic understanding of how macro's work, and through learning can easily understand most of the macros. I don't think they were meant to be read by the average user, they just perform certain routines to make life easier...

Do you have any special reason to understand the inner workings of these?
Post 14 Mar 2008, 05:13
View user's profile Send private message Visit poster's website Reply with quote
bdsatish



Joined: 07 Mar 2008
Posts: 10
bdsatish 14 Mar 2008, 08:31
Quote:
Do you have any special reason to understand the inner workings of these?
Not at all. I thought (beginner, you see) that i can understand what's found in the macros of 'include' directory. As you said, rightly, these things are not meant for an average user. I need to move to the above-average bracket quite soon Smile
Post 14 Mar 2008, 08:31
View user's profile Send private message Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP 14 Mar 2008, 17:05
Well, even I cannot remotely understand some of their work. I still consider myself a beginner in ASM, and I only feel the need to use basic macros, so it'll be awhile before I start on learning high-level features of FASM. Good luck!
Post 14 Mar 2008, 17:05
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1905
DOS386 16 Mar 2008, 00:42
.

> My ques was regarding -l listing.lst and not -f elf

Sorry, forgot to mention the most important thing Sad

The official FASM releases don't support listing, as already pointed ( http://board.flatassembler.net/topic.php?t=3908 ) there is an "unofficial" listing hack from Tomasz ... no idea why this still isn't an "official" feature, this had been pointed many times in the past:

http://board.flatassembler.net/topic.php?p=72835#72835

The reason about the macros is obvious: "Windows"-geeks coming from MASM expect them, because MASM supports such stuff, Linux-geeks coming from NASM and GAS don't need them, since NASM and GAS don't have such "features" either Idea

> I had to figure out the hard way that: 'segment' & 'entry' directives are not allowed when creating an object file.

segment is documented under format MZ making obvious that it's supported only then Idea

And YES, the docs could be improved a bit:

- Sign of conditional jumps
- Core vs macros
- PE support core vs macros
- Warn about "unsafe" instructions
- Split off 64-bit and SSE from main manual
Post 16 Mar 2008, 00:42
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.