i have been using MASM to do my assembly, recently i wanted to switch
over to GAS (Linux), and i was wondering if there are any fundamental
differences between the two (syntax and such)?
i used to run my MASM on an old 486, now i am thinking of making it into
a linux box, and i would like to know if my old assembly programs would
still run under GAS though now it's a different OS.
thanks in advance.
Sent via Deja.com
http://www.deja.com/
Get the FAQs http://www2.dgsys.com/~raymoon/x86faqs.html
<yaw...@my-deja.com> wrote in message
news:t7tu032...@corp.supernews.com...
>
> hi all:
>
> i have been using MASM to do my assembly, recently i wanted to switch
> over to GAS (Linux), and i was wondering if there are any fundamental
> differences between the two (syntax and such)?
>
> i used to run my MASM on an old 486, now i am thinking of making it into
> a linux box, and i would like to know if my old assembly programs would
> still run under GAS though now it's a different OS.
>
Well, despite the appearance of the ".intel_syntax" directive and lots of
neat macro facilities (similar to MASM), I'm am still of the opinion that
Gas is unsuitable for human consumption (keep in mind, Gas' purpose
is to assemble the output of GCC).
The problem is, Gas assumes that the input source file is syntactically
correct (the compiler always emits syntactically correct assembly
code). Alas, code humans write often contains errors. Gas isn't
too good about handling bad input. The diagnostics are bad and
often non-existant (e.g., Gas assumes that all undefined symbols
are external).
Although I don't have much experience with either product, I'd
probably recommend NASM over Gas. Gas is more powerful,
but NASM was written to be used by Human Beings. This
can make a big difference when writing assembly code under
Linux.
Randy Hyde
If I were you, I'd probably use NASM instead since it can be run under
Linux, supports a lot of object file formats (A.OUT, COFF, ELF, etc) and
uses intel syntax.
Good Luck
--
Alexei A. Frounze
alexfru [AT] chat [DOT] ru
frounze [AT] ece [DOT] rochester [DOT] edu
http://alexfru.chat.ru
http://members.xoom.com/alexfru/
http://welcome.to/pmode/
<yaw...@my-deja.com> wrote in message
news:t7tu032...@corp.supernews.com...
>
> i have been using MASM to do my assembly, recently i wanted to switch
> over to GAS (Linux), and i was wondering if there are any fundamental
> differences between the two (syntax and such)?
The syntax is fundamentally different: the order of source and
destination
operands is reversed: mov eax, 1234h becomes movl $0x1234, %eax.
See http://www.rt.e-technik.tu-darmstadt.de/~georg/djgpp/djgpp_asm.html
But it's not that hard to learn. Think of it as an exercise
in mental flexibility.
> i used to run my MASM on an old 486, now i am thinking of making it into
> a linux box, and i would like to know if my old assembly programs would
> still run under GAS though now it's a different OS.
The programs can be ported, but the syscalls will all be different
No int21h under Linux (but int 0x80 with different numbers!).
-- Robert
> AFAIK, natural syntax for GAS/AS is AT&T which is quite different
> from that of proposed by intel and supported in MASM, TASM and a lot
> of other assemblers.
>
> If I were you, I'd probably use NASM instead since it can be run
> under Linux, supports a lot of object file formats (A.OUT, COFF,
> ELF, etc) and uses intel syntax.
I'm finding nasm more human-friendly, with it's legible syntax and its
texinfo-format documentation. (And with Paul Carter's helpful
tutorial, which uses nasm-style code.)
The Linux Assembly HOWTO says:
Its hand-written parser makes it much faster than GAS, though of
course, it doesn't support three bazillion different
architectures.
www.linuxassembly.org/resources mentions a couple of tools that
translate from nasm's to gas' syntax. I wonder if anyone is using
those tools regularly and with success?
--
--Ed Cashin integrit file-verification system:
eca...@coe.uga.edu http://integrit.sourceforge.net/
Note: If you want me to send you email, don't munge your address.