Live data from Hacker News

AT&T Syntax versus Intel Syntax (2001)

cs.mcgill.ca

11–20 of 112 posts

Re: AT&T Syntax versus Intel Syntax (2001)

#11

AT&T vs. Intel syntax has caused many arguments in some of my circles. AT&T is an atrocity and if you disagree... you're wrong. :)

op src dest is the logical order, the rest of the syntax I don’t care about much.

TFA says "The `source, dest' convention is maintained for compatibility with previous Unix assemblers."

Re: AT&T Syntax versus Intel Syntax (2001)

#12

AT&T vs. Intel syntax has caused many arguments in some of my circles. AT&T is an atrocity and if you disagree... you're wrong. :)

op src dest is the logical order, the rest of the syntax I don’t care about much.

In mathematics variable = value, variable receives value, ergo op dest src.

That is logic.

Re: AT&T Syntax versus Intel Syntax (2001)

#13

AT&T vs. Intel syntax has caused many arguments in some of my circles. AT&T is an atrocity and if you disagree... you're wrong. :)

op src dest is the logical order, the rest of the syntax I don’t care about much.

That “logical” order is only because you’re trying to read it like a sentence (“mov/add ebx into eax”) when you should be reading it like a formula or what it actually is - code. And that’s fine, but considering Intel created the chip, it makes sense that they should decide how the assembly syntax should be, not AT&T.

The only reason “AT&T syntax” exists for x86 is because people working at AT&T refused to use Intel as the authoritative reference on the syntax, and, instead, decided to follow the convention of the PDP, Motorola, etc. family and friends. Hence why `as` (and subsequently `gas`) have that as the default.

Re: AT&T Syntax versus Intel Syntax (2001)

#15
post #12

Earlier quoted context omitted.

op src dest is the logical order, the rest of the syntax I don’t care about much.

In mathematics variable = value , variable receives value, ergo op dest src . That is logic.

Indeed. Besides, “let there be light” is clearly destination-first, so this matter was already resolved by Genesis 1:3.

Re: AT&T Syntax versus Intel Syntax (2001)

#16
post #12

Earlier quoted context omitted.

op src dest is the logical order, the rest of the syntax I don’t care about much.

In mathematics variable = value , variable receives value, ergo op dest src . That is logic.

That doesn’t follow. variable = value, ergo dest op src.

Re: AT&T Syntax versus Intel Syntax (2001)

#17
post #8

AT&T vs. Intel syntax has caused many arguments in some of my circles. AT&T is an atrocity and if you disagree... you're wrong. :)

They are using a classic dollar sign for assignment, so clearly at&t is better.

Contemplate the AT&T vs Intel syntax for x86 addressing modes and say that again.

Re: AT&T Syntax versus Intel Syntax (2001)

#18
post #17
post #8

Earlier quoted context omitted.

They are using a classic dollar sign for assignment, so clearly at&t is better.

Contemplate the AT&T vs Intel syntax for x86 addressing modes and say that again.

X86 addressing modes are an atrocity: https://stackoverflow.com/questions/63571979/clarifying-thre...

Re: AT&T Syntax versus Intel Syntax (2001)

#19
Here's the why for the curious. It's just a historical quirk.

It's "AT&T syntax" because it dates to the 1978 AT&T Labs effort to port UNIX to the 8086. [1] While the 8086 did not have virtual memory or hardware protection, its memory segmentation model was still adequate to support UNIX. It was the first microprocessor practically capable of running UNIX, and this was realized before the chip was even released. The porting effort started immediately. (Though most of the energy would soon switch to the 68000 when that was released a year later.)

The AT&T folks did not wait for Intel's assembler. (Written in Fortran, to run on mainframes, or on Intel's development systems). Nor did they closely model their assembler after it. They just took the assembler they already had for the PDP-11 and adapted it with minimal changes for the 8086. Quick and dirty. Which was okay. You're not supposed to write assembly on UNIX systems, anyway. Only the poor people who had to write kernel drivers and compilers would ever have to deal with it.

[1] https://www.bell-labs.com/usr/dmr/www/otherports/newp.pdf (see section III)

Re: AT&T Syntax versus Intel Syntax (2001)

#20
post #2

Hmm. "AT&T"? I thought it at least came from DEC via the PDP-11,7 assembler. And I'm guessing Intel didn't invent doing it backwards in their own either.

Wikipedia confirms it. https://en.wikipedia.org/wiki/X86_assembly_language#Syntax "The AT&T syntax is nearly universal to all other architectures with the same mov order; it was originally a syntax for PDP-11 assembly. The Intel syntax is specific to the x86 architecture, and is the one used in the x86 platform's documentation." https://en.wikipedia.org/wiki/As_(Unix) "As of November 1971, an assembler invoked as as…

[deleted]
Post reply on HN