Assembly syntax: INTEL vs. AT&T

Assembly syntax: INTEL vs. AT&T

One thing that I incurred almost immediately staring my journey was learning x86 assembly, and you have to know that there are two different syntaxes around: the INTEL and the AT&T one. In my opinion, INTEL has the highest legitimacy to set syntax since they have designed the processor, so it is up to them to specify how to make the processor work. Strictly speaking, no other syntax should ever exist. Indeed we are not talking about high-level human-oriented programming language (in this case every language has a purpose and is legitimated by it) but low-level machine-oriented language, and again, sorry for the repetition, if INTEL designs the CPU then INTEL says how the CPU has to be operated: no other syntax should be used. Having said that, I don’t exclude that one day during my journey, if I got to the point to have enough knowledge to do it, I can design a third assembly syntax on my own (just for fun). Besides INTEL Syntax there is the AT&T one. I suppose they had their very good reasons to come up with a different syntax from the INTEL one (rather than just for fun as I feel like to do) and indeed this is the syntax used in the open community of LINUX. I am very grateful that this community exists, so the small overhead of learning a slightly different syntax is more than welcome. Some say that the AT&T syntax is more natural than the INTEL one but to me, it is exactly the opposite way around.
Let´s consider the registers AX and BX. Let's say AX = 0 and BX = 3 before the MOV command, and AX = BX = 3 after the MOV command. The two syntaxes for that are:

Assembly syntax: INTEL vs. AT&T
Fig. A

Besides the % sign of the AT&T syntax, many people on the internet say that the AT&T is more natural because it moves content from BX to AX register. For me, it is true the opposite way around because we write "AX = BX" when we want that the content of BX should go in AX, or more generally we say "X = 3" or again "my_variable = something". So for me is much more natural to look at the INTEL syntax that presents the command like "MOV destination, source" and think in my mind "destination = source".
Another example is with mathematical operations:

Assembly syntax: INTEL vs. AT&T
Fig.B

What it does is: "AX = AX + BX". Again for me, it is more natural to find AX first and then BX.
But where the AT&T syntax really goes crazy is at dealing with the addressing mode:

Assembly syntax: INTEL vs. AT&T
Fig. C

Looking at the INTEL syntax, it is immediate to think to "AX = BX + CX*4 - 20" but the same in AT&T syntax is a very unnatural way of thinking to me. The conclusion is that I like the INTEL syntax, but I can live with both. And you do not have to listen to me, but rather make your own opinion about that. What do you think? Let me know in the comment.

Comments