assemblyx86nasmattintel-syntax

NASM (Intel) versus AT&T Syntax: what are the advantages?


I'm going through the Intel processor documentation and writing some basic assembly code at the same time. I have both nasm and as (GAS) on my server and I understand the basic differences of both assemblers.

In the long run:

I would also appreciate any preferences you could share with me.


Solution

  • Depends on your projects. Not every compiler does allow both kinds of syntax. If you need to have to code assembled on other platforms Intel is probably better, even after some years experience with both I personally like Intel more, but it`s a small difference, and it doesn't really matter to me.

    In the AT&T syntax there are slightly to much %, even more if you need to use macros. OTOH I prefer the source, destination ordering, but thats personal taste, others may prefer it the other way around because it resembles the writing order of an assignment operator in say C (and many more).

    I INTEL syntax the are obscenities like DWORD PTR, where in AT&T a small appended l is sufficient. The exact spelling of the mnemonics differs in many cases, I find the AT&T more logical while of course Intels way is the standard. The addressing modes in Intel are somewhat more readable.

    I believe AT&T is more used, because of the ubiquitousness of linux on embedded platforms, where assembler is much more often used that in other software projects. There are more assemblers which understand Intels syntax, that much is true, but I believe gcc/gas is more used in a field where assembler matters/is useful .