The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: James Ladd on September 05, 2005, 10:35:04 PM

Title: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 05, 2005, 10:35:04 PM

Please can someone tell me what is a good assembler for developing apps for Windows and for Linux ?
(Have you used the suggested assembler or just know it exists?)

Would I be better off using a dedicated assembler for each platform, ie: MASM for Windows and
'xxx' for Linux ?
(Ideally I dont want to have to code the application twice)

I look forward to the response.

Rgs, Striker.
Title: Re: Which assembler for Win32 and Linux ?
Post by: hutch-- on September 05, 2005, 10:42:02 PM
James,

FASM has the legs here but NASM has been able to do this for years so its a decent contender as well. Just note that it will feel like a very different animal after using MASM.
Title: Re: Which assembler for Win32 and Linux ?
Post by: roticv on September 06, 2005, 01:13:34 AM
I vote for FASM
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 06, 2005, 03:39:24 AM
Thanks for the replies.

I have looked at NASM but wonder why people suggest FASM ?

Rgs, Striker.
Title: Re: Which assembler for Win32 and Linux ?
Post by: comrade on September 06, 2005, 03:42:25 AM
because it is actively developed and has new features

NASM is outdated
Title: Re: Which assembler for Win32 and Linux ?
Post by: hutch-- on September 06, 2005, 04:39:17 AM
One of the virtues of NASM is that it is apparently part of at least some LINUX distributions so it will be on many linux boxes already. Development in FASM is a lot more active and it is probably a more modern assembler but NASM tends to be a linux industry standard so don't write it off.
Title: Re: Which assembler for Win32 and Linux ?
Post by: Vortex on September 06, 2005, 05:04:10 AM
I remember that it is possible to run Masm on Linux with an emulator.
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 06, 2005, 08:55:01 AM
Ok, so FASM looks like a good tool.

Plenty of examples for what im needing and it doesnt look like a major jump from MASM.

What debugger is recommended for FASM ?

Thanks again for the feedback/suggestions.

Rgs, striker.
Title: Re: Which assembler for Win32 and Linux ?
Post by: rea on September 06, 2005, 03:46:51 PM
Also look at yasm (http://www.tortall.net/projects/yasm/).
Title: Re: Which assembler for Win32 and Linux ?
Post by: farrier on September 06, 2005, 04:05:26 PM
striker,

I have switched completely to the FASM for my Win32 programming needs.  For Win32/64 Ollydbg is still the debugger for me.  Tomasz has included a series of macros that allow an almost direct use of MASM code in the FASM.  The only thing I still miss is the lack of multi-conditional if statements:

if ( a < b) .and. ( c > d )

is not supported.  I can't comment on Linux programming, but many use it for Win, DOS, Linux, FreeBSD, OpenBSD and others.  And the response time to questions and requests is usually quite timely!  The FASM forum is as helpful as this one.

Hope you will enjoy it!!

farrier
Title: Re: Which assembler for Win32 and Linux ?
Post by: epoch on September 07, 2005, 10:05:59 AM
I would say go for yasm too.. when it comes to linux.

If you want more general info on linux, aside asm, try www.linux-reactor.com..
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 07, 2005, 10:03:16 PM
Thankyou to everone who replied.
I like FASM a lot and think Ill give it a go.

Does anyone have an example of a Linux SO in FASM that could get me started ?
I found on for Win32 here: http://sulaiman.netadvant.com/fasm/tut_17.html

Update: Ok, downloaded FASM, ran it, liked it !!

Now all I need is an example .SO  <- Has someone got one ?

Rgs, striker
Title: Re: Which assembler for Win32 and Linux ?
Post by: drhowarddrfine on September 08, 2005, 11:29:25 PM
Unix Assembly Language (http://www.int80h.org/bsdasm/)

Might be helpful.
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 09, 2005, 08:47:54 AM
Dr,
Thanks for the link. Very interesting.
Im still needing an example of a SO in linux.

From memory of my 'C' days it just a file of exported routines linked a different way.
Id like to see an example to be sure.

Rgs, Striker
Title: Re: Which assembler for Win32 and Linux ?
Post by: Tedd on September 09, 2005, 12:41:01 PM
.so is just an elf format file. I think this is the type nasm/yasm will output if you specify "-f elf"
(There are actually 3 different types of elf file, which is so helpful :bdg)
Title: Re: Which assembler for Win32 and Linux ?
Post by: arafel on September 09, 2005, 01:23:56 PM
Assemble to an ELF and link (ld) with '-shared' switch. Then you can call functions for a dynamicaly loaded library:

handle = dlopen("/mylib.so", RTLD_LAZY);
my_function_hndl = dlsym(handle, "my_function");
my_function_hndl();
dlclose(handle);


edit: also '-soname' ('-soname,mylib.so') switch should be used
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 09, 2005, 10:30:37 PM
arafel,

Thanks for this.
I thought it may be via a link option.

Do you know if there is anything special that has to be done in the module source code?
ie: In a normal "main" you have a "start:" , but is there an entry point in the module is
its going to be a shared library ?

Rgs, striker.
Title: Re: Which assembler for Win32 and Linux ?
Post by: IAO on September 09, 2005, 10:35:31 PM
Hi to all....


I don't write well English. But:

Look here.
http://webster.cs.ucr.edu/AsmTools/WhichAsm.html

I think, one good elecctions is HLA.

By(t)e ('-')
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 09, 2005, 11:29:59 PM
nice link thanks.
Title: Re: Which assembler for Win32 and Linux ?
Post by: arafel on September 09, 2005, 11:40:33 PM
striker,

I am not sure how this applies for writing shared libs in assembly, but only requirement for gcc compiled shared libs is to have position independent code (-fpic switch). Neither anything specific must be done regarding entry point when making shared lib in C, so I guess it's the same for nasm/fasm. Just exporting needed functions will do the trick.
Title: Re: Which assembler for Win32 and Linux ?
Post by: arafel on September 10, 2005, 12:41:59 AM
here is a little nasm example

[attachment deleted by admin]
Title: Re: Which assembler for Win32 and Linux ?
Post by: arafel on September 10, 2005, 12:56:54 AM
just found tutorial in nasm documentation about writing shared libraries...
http://alien.dowling.edu/~rohit/nasmdoc8.html#section-8.2
Title: Re: Which assembler for Win32 and Linux ?
Post by: James Ladd on September 10, 2005, 02:58:37 AM
arafel,

Thanks for the link and the zip. Its very helpful of you.

rgs striker.