NASM (Intel) vs. AT & T syntax: what are the benefits?

I look through the documentation for the Intel processor and write several basic assembler codes at the same time. I have both nasm and as (GAS) on my server, and I understand the main differences between both collectors.

Ultimately:

  • Focusing on which of these syntaxes is the best idea?
  • What are the advantages and disadvantages of this syntax?
  • Which one is more widely used and understood?

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

+4
source share
2 answers
  • Focusing on which of these syntaxes is the best idea?

Depends on your projects. Not every compiler allows both kinds of syntax. If you want the code to be built on other platforms, Intel is probably better, even after several years of experience with both individuals and Intel, but this is not a big difference, and it doesn’t really matter to me.

  • What are the advantages and disadvantages of this syntax?

There is slightly more % AT & T syntax, even if you need to use macros. OTOH I prefer the source, the order of destination, but it’s personal taste, others may prefer it the other way around, because it resembles the order in which the assignment operator is written, for example, in C (and much more).

I INTEL syntax is obscene, such as DWORD PTR , where AT & T has a small attached l . The exact spelling of the mnemonics is different in many cases, I believe that AT & T is more logical, although, of course, the Intels path is the standard. Intel's addressing modes are somewhat readable.

  • Which one is more widely used and understood?

I believe AT&T is more used due to the ubiquity of Linux on embedded platforms, where assembler is much more commonly used in other software projects. There are more assemblers that understand the Intels syntax, that's true, but I believe that gcc / gas is used more in a field where the assembler is / useful.

+4
source

Focusing on which of these syntaxes is the best idea?

What is more convenient for you to work with

What are the advantages and disadvantages of this syntax?

For me: Advantages: - Intel: readable - AT & T: more platforms (since "how" is available on many platforms) Disadvantages: - Intel: many assemblers, but very few common similarities, many functions are specific to assembler - AT & T: adds +/- to your eyes.

Which one is more widely used and understood?

Intel AFAIK syntax is more widely used. You can check the number of assemblers supporting Intel vs AT & T.

+4
source

Source: https://habr.com/ru/post/1386889/


All Articles