The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: SunSpyda on April 12, 2009, 02:05:02 PM

Title: NASM, FASM, or SolASM?
Post by: SunSpyda on April 12, 2009, 02:05:02 PM
I am migrating from AT&T to Intel assembly, so I am in the market for a new assembler to replace Gas. Sorry if there have already been a zillion questions on the matter, but I was wondering which assembler would be suitable.

I want a assembler that produces very fast code (Mind you, pretty much all assemblers do this), and I am not bothered about having HLL features like 'if else'.

Whilst MASM looks great, it isn't an option, because it only functions on Windows. I know this is a MASM forum, but seeing as I am still coding in the Intel syntax, I don't see a problem....  :bg

I have had 3 recommendations from people around here..

Netwide Assember - NASM
Flat Assembler - FASM
Solar Assembler - SolASM

I heard Flat is very fast and contains no HLL stuff, which would be ideal. NASM is widely used, so it's quite compatable. I have also heard positive things about SolASM.

So which one do you all think would be good for me to start Intel Assembly on? Thanks in advance =)
Title: Re: NASM, FASM, or SolASM?
Post by: mitchi on April 12, 2009, 02:13:21 PM
Well try them. It's really a MASM forum here so people so I don't think you will get many comments about this.
I will just say this : If I had to write a linux program in assembly, I wouldn't mind using any of these 3 to get the job done. So the rest is up to your personal preference now.
Title: Re: NASM, FASM, or SolASM?
Post by: Mark Jones on April 12, 2009, 04:02:16 PM
With that, I would also suggest sticking with which ever one you choose. Trying to learn all three would be daunting indeed.

Also, for your purposes, check out Agner's Objconv utility: http://www.agner.org/optimize/#objconv
Title: Re: NASM, FASM, or SolASM?
Post by: brethren on April 12, 2009, 08:12:07 PM
Why change your assembler, gas supports intel syntax
http://en.wikipedia.org/wiki/GNU_Assembler
Title: Re: NASM, FASM, or SolASM?
Post by: hutch-- on April 13, 2009, 03:02:48 AM
I would second using the GNU assembler in Intel mode, its a good tool, a bit raw here and there but it works well and powerful enough once you are used to it.
Title: Re: NASM, FASM, or SolASM?
Post by: SunSpyda on April 13, 2009, 11:52:06 AM
Quote from: brethren on April 12, 2009, 08:12:07 PM
Why change your assembler, gas supports intel syntax
http://en.wikipedia.org/wiki/GNU_Assembler

Yeah, I was thinking about this, but last time I checked, the intel_syntax option didn't really work very well. For example it still required AT&T register prefixes (This has now been fixed apparently), and it still used # for comments rather than ;. But then again, it was about half a year ago I last checked, and a lot of these problems have probably been sorted out by now.

So, I will take a look at this, seeing as Gas is pretty ideal for me, bar the AT&T syntax.

Thanks for the help, and yes I will only stick to 1 assembler, using more than 1 just seems like too much work.
Title: Re: NASM, FASM, or SolASM?
Post by: Vortex on April 13, 2009, 05:13:24 PM
Hi SunSpyda,

If you are interest in using Gas in Intel syntax mode, here are some links for you:

http://www.masm32.com/board/index.php?topic=3464.0

http://www.masm32.com/board/index.php?topic=3490.0

http://www.masm32.com/board/index.php?topic=4831.0

SolAsm is a very fast assembler capable of creating EXE, OMF,COFF and ELF OBJ. The syntax is similar to that of Tasm, Borland's Turbo Assembler.
Title: Re: NASM, FASM, or SolASM?
Post by: BogdanOntanu on April 14, 2009, 12:12:19 AM
Quote from: Vortex on April 13, 2009, 05:13:24 PM
SolAsm is a very fast assembler capable of creating EXE, OMF,COFF and ELF OBJ. The syntax is similar to that of Tasm, Borland's Turbo Assembler.

Thanks for the advertisement ;)

One extra thing: Sol_ASM can also create a flat binary designed to run at an absolute address (for OS development).
In fact Solar_Os is now written in Sol_Asm.
Title: Re: NASM, FASM, or SolASM?
Post by: Vortex on July 11, 2009, 08:18:38 AM
New SolAsm version 0.28.14 available from :

http://oby.ro/sol_asm/sol_asm_download_bin.htm

Title: Re: NASM, FASM, or SolASM?
Post by: ramguru on July 13, 2009, 09:33:30 PM
Quote from: Vortex on July 11, 2009, 08:18:38 AM
New SolAsm version 0.28.14 available from :

http://oby.ro/sol_asm/sol_asm_download_bin.htm


Tried to compile win64 example
..it won't run, something's bad with PE32+ header (too many zeros  :lol )
Title: Re: NASM, FASM, or SolASM?
Post by: BogdanOntanu on July 14, 2009, 08:12:49 AM
Quote from: ramguru on July 13, 2009, 09:33:30 PM

Tried to compile win64 example
..it won't run, something's bad with PE32+ header (too many zeros  :lol )

Thanks for your report ramguru. I will check it out.

Regards,
Bogdan
Title: Re: NASM, FASM, or SolASM?
Post by: MichaelW on July 14, 2009, 02:14:16 PM
SunSpyda,

Recent versions of GAS allow C-style comments anywhere, for example:

/* this is a  comment */

Or for single line comments:

// this is a comment

But this will not work for a trailing comment on a line.

I posted a console and a GUI app along with some support code here:

http://www.masm32.com/board/index.php?topic=8689.0

Title: Re: NASM, FASM, or SolASM?
Post by: Logman on July 16, 2009, 11:59:30 AM
I just switched back to using MASM32, but used to use NASM, then picked up on FASM because of its simplicity and speed.

FASM also comes with a basic IDE, which installs fairly easy. Once you unzip the FASM files, the program is ready to work. You can move it to any drive or directory you want, even use it from a thumb drive (USB).

NASM has to muck around in your registry and that can be problematic, especially if you work for the government or in an office where you don't have administrative rights on your system. I liked NASM, but I switched at a time it seemed to go unsupported. Updates are far an few between. So, on the one hand it remains stable for long periods, but doesn't get updated as often.

One other choice is to use GoAsm. GoAsm has a really nice IDE and installs as easily as FASM. Both FASM and GoAsm have a lot going for them. Of the three, I think GoAsm has the best documentation and is the easiest to pickup on. FASM doesn't use a lot of the MASM conventions and like NASM, doesn't do any type-checking. FASM also only works in flat32 mode--no DOS or 64-bit mode (yet).

In my opinion, GoAsm has a better overall forum and much better support. The program gets updated often and produces both Win32 and Win64 code.

I trided HLA for awhile and in its own way, works terrific--I liked it, but it was like programming in Pascal, C, and assembler all at once and I didn't want to learn that aspect of it. It is exceedingly well supported; lot's of documentation and frequent updates.

Anyway, having programmed all my life in MASM 1.0 - 5.0, I came back. I'm just used to its syntax and macros. For me, it's an all-around winner because you can use as much of its complexity as you want or none at all--just use the barebones code.

Logman
Title: Re: NASM, FASM, or SolASM?
Post by: farrier on July 17, 2009, 05:12:51 PM
Logman,

I'm wondering what fasm you were using.  The proper one is at flatassembler.net. 

"FASM doesn't use a lot of the MASM conventions"

There is very little that Masm can do that fasm can't, with the help of usability macros, most Masm features are available.

"FASM also only works in flat32 mode--no DOS or 64-bit mode (yet)."

Everything here is incorrect.  Dos, linux, DexOs, BSD, 16-32-64 bit.  As well as support for ARM chipped machines.  New things added all the time.  And for all but the most complex apps, no linker is required.  The fasm will assemble and construct the executable/DLL in one step.  You just tell it what you are constructing.

Just to let you know you may have missed a lot of the capabilities of the fasm.  Enjoy Masm32!

farrier

Title: Re: NASM, FASM, or SolASM?
Post by: Vortex on July 17, 2009, 07:16:23 PM
Quote from: farrier on July 17, 2009, 05:12:51 PM
And for all but the most complex apps, no linker is required.

Fasm supports direct PE output and it can create MS COFF object modules.
Title: Re: NASM, FASM, or SolASM?
Post by: farrier on July 17, 2009, 09:20:53 PM
Thanks, Vortex!!

I wasn't very clear with that comment.  The fasm can output .obj files as Masm can, which can be linked with other .obj files or .lib files.  But if all your code is in fasm files, you can just specify a .com, .exe or .dll output file.  No linker required, but linkable file output is supported.

Again,

Thanks.

farrier
Title: Re: NASM, FASM, or SolASM?
Post by: BogdanOntanu on July 18, 2009, 10:37:34 AM
Quote from: farrier on July 17, 2009, 09:20:53 PM
... The fasm can output .obj files as Masm can, which can be linked with other .obj files or .lib files.  But if all your code is in fasm files, you can just specify a .com, .exe or .dll output file.  No linker required, but linkable file output is supported.

Sol_Asm CAN do that also.

And AFAIK Nasm and Yasm can also do that...

@ramguru:
In  Sol_Asm version 0.29.03 I have fixed that PE32+ (64bits) output problem/bug.
Now the Win64 message box sample works OK (at least on my computer  :green)

You can get it here: http://www.oby.ro/sol_asm/files/sol_asm_2009_07_18_v29_03.zip
Title: Re: NASM, FASM, or SolASM?
Post by: ramguru on July 18, 2009, 11:28:17 AM
Quote from: BogdanOntanu on July 18, 2009, 10:37:34 AM
..
Now the Win64 message box sample works OK (at least on my computer  :green)

You can get it here: http://www.oby.ro/sol_asm/files/sol_asm_2009_07_18_v29_03.zip

Yeah it does .. thank you for fixing that  :U
It seems 'invoke' isn't very win64 friendly if I uncomment (in example)
   ;----------------
   ; alternatively
   ;----------------
   invoke Mess..
app crashes, 'cuz stack gets messed up ..
Title: Re: NASM, FASM, or SolASM?
Post by: ecube on July 18, 2009, 11:40:49 AM
GoASM is imo absolutely incredible, while it's built for windows, there's really no other assembler out that makes programming in 64bit as easy yet so power, and it simplifies by removing/not needing the few things in masm I felt were tedious like writing protos over and over. I've converted probably 400
sources i've written in masm to a hybrid GoASM 32bit/64bit versions, only a few macros are holding me back :D

Nasm window support is almost non-existant, I don't mean it's not capable of producing pe files, because it is, I mean the windows user/support base isn't there. Masm ofcourse has the best support base of all the assemblers thanks to the masm32 project.

FASM is great, I don't care much for its syntax myself, but it's the second best assembler to dive into 64bit programming on windows, and its support base is really active. The entire MenuetOS was written in FASM, which unlike most hobby os's it has 32bit/64bit versions, a browser, game ports(doom etc..) and many other neat things

SolASM seems like a interesting start, and is quite capable of a lot of things, but playing around with it myself, I got the impression that it's not very matured and in its current state I personally wouldn't rely on it for any serious coding.

JWASM you might not of heard of this one, but it's almost a full masm clone based off the WASM source. So basically you can write programs for windows and linux in masm's syntax which I think is pretty neat. The author was once a moderator on this forum but he just randomly abandoned us 1 day so I haven't kept up with the project

POASM Vortex and others are huge fans of poasm, it's an assembler that comes with Pelle C, and it has a masm like syntax. I personally never used it much and from reading the authors comments on it, I got the feeling his focus isn't much on PoASM which made me lose interest as again with no support theres no point :)
Title: Re: NASM, FASM, or SolASM?
Post by: ramguru on July 18, 2009, 12:30:25 PM
damn I can't just leave w/o reviewing assemblers myself (but be warned I will rather mention bad things instead of good)
only about what concerns me 64bit that is ..
GOASM - has indeed powerful 64bit support, & assembles EVERYTHING, you may not worry about argument sizes when passing them to invoke .. because it will get assembled anyway. But it's not an assembler where you get exactly the same result as expressed with your code instructions. You will get SOMETHING .. usually bigger & maybe optimized. Also it uses some wrapper for procedure calls so you'll get hard time disassembling it. Pe sniffer even reports its generated apps are compressed with Armadillo because of the mess inside :}

NASM ..

FASM is the closest to WYSIWYG assemblers .. its core is very basic & primitive, but macroinstructions is what makes it a great tool. Basically when you finally understand all its macro capabilities, then you've gained enough knowledge to write at least your own asm parser. It has fair 64bit support which expands each day, with macros updates. The main disadvantage as I see it - no addr support. Meaning address of local structure must be manually loaded with lea.. & passed. Despite that this assembler has a bright future for 64bit development..

SolASM is in the middle of its development so I can't judge it much yet .. current situation - humble 64bit dev. support :>

JWASM doesn't support 64bit .. too bad

POASM is very close of having the best 64bit support with its PARMAREA directive .. but
there is something terribly annoying with its linker flag "/LARGEADDRESSAWARE"
Basically you want it to be set to 'YES', & it's set by default 'yes' in all other assemblers.
But once it's set to 'YES' in poasm you'll have to go through a nightmare to correct your code
For example you think this code will assemble correctly ?
hInstance dq ?
..
mov hInstance, rax

You are wrong, you'll have to use register somehow to place a value there
hInstance dq ?
..
mov rcx, OFFSET hInstance
mov [rcx], rax
Title: Re: NASM, FASM, or SolASM?
Post by: dancho on July 18, 2009, 01:35:36 PM
Quote from: ramguru on July 18, 2009, 12:30:25 PM
JWASM doesn't support 64bit .. too bad

actually jwasm does support 64bit ( experimental  :wink )
http://www.japheth.de/Download/jwasm197b.ZIP
Title: Re: NASM, FASM, or SolASM?
Post by: farrier on July 18, 2009, 05:16:50 PM
Quote from: ramguru on July 18, 2009, 12:30:25 PM
FASM is the closest to WYSIWYG assemblers .. its core is very basic & primitive, but macroinstructions is what makes it a great tool. Basically when you finally understand all its macro capabilities, then you've gained enough knowledge to write at least your own asm parser. It has fair 64bit support which expands each day, with macros updates. The main disadvantage as I see it - no addr support. Meaning address of local structure must be manually loaded with lea.. & passed. Despite that this assembler has a bright future for 64bit development..

Actually, if you include the:
win32ax.inc
file, you get addr support and it does not corrupt eax--unlike Masm.  Tomasz stated today that a 64 bit addr will be implimented.

farrier
Title: Re: NASM, FASM, or SolASM?
Post by: BlackVortex on July 18, 2009, 06:39:23 PM
Interesting thread. I'm still sticking with GoAsm, waiting for runtime conditionals.