On Linux, is there a way to convert an assembly language file from one syntax to the other? I know that there are ways to ask GCC to emit one syntax or the other, as well as ways to assemble code in either syntax. However I don't know any program that just translates one to the other.
AT&T Syntax versus Intel Syntax (2001)
71–80 of 112 posts
Re: AT&T Syntax versus Intel Syntax (2001)
#72Hmm. "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.
It's the AT&T syntax because AT&T are the one who unleashed that on the world against the wishes of everyone. See the sibling comment: > The AT&T folks did not even wait for Intel's assembler [...] 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.
Re: AT&T Syntax versus Intel Syntax (2001)
#73Earlier quoted context omitted.
Also the % before register names is completely unnecessary, it just another extra character to type.
It disambiguates labels from registers, assuming of course you allow labels to have register names. eg this is valid: mov rax,%rax rax: .ascii "hello\0" Stupid perhaps, but valid.
One of the x86 assemblers I remember trying out in the late 80s had a slight variant of Intel syntax in that everything that wasn't a reserved word/mnemonic was automatically assumed to be a label.
Re: AT&T Syntax versus Intel Syntax (2001)
#74Earlier 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.
You know what the logical convention to use would have been? The order that every assembler on the planet already used.
Re: AT&T Syntax versus Intel Syntax (2001)
#75The one thing AT&T syntax has going for it is the "strong typing" of operand widths: `addl` is slightly more readable than `add` + operand-inferred width.
If you want the C preprocessor, you can have it with Intel syntax too (gas can use either), but I think the preprocessing syntax designed for assembly is cleaner with assembly code, and some of those preprocessors are surprisingly powerful.
Re: AT&T Syntax versus Intel Syntax (2001)
#76AT&T syntax is the most elite syntax. I've used it to write some famous hacks, like Actually Portable Executable, which is a 16-bit BIOS bootloader shell script ELF / Mach-O / PE executable. People dislike it because writing assembly Bell Labs style requires great responsibility. What makes AT&T syntax so powerful is its tight cooperation with the linker. I don't think it would have been possible for me to invent APE…
I didn’t think it ever really makes sense to disagree with a comment like this, unless one is claiming that the content of your comment is intentionally untrue. Anyways, appreciate your perspective.
Re: AT&T Syntax versus Intel Syntax (2001)
#77In a dumb idea to depend only on GAS, before it had good support for Intel syntax, I ported some code from Intel syntax into AT&T many moons ago, quite dumb idea, if i was doing it today I would have listed nasm or yasm as a requirement and be done with it.
Re: AT&T Syntax versus Intel Syntax (2001)
#78AT&T syntax is the most elite syntax. I've used it to write some famous hacks, like Actually Portable Executable, which is a 16-bit BIOS bootloader shell script ELF / Mach-O / PE executable. People dislike it because writing assembly Bell Labs style requires great responsibility. What makes AT&T syntax so powerful is its tight cooperation with the linker. I don't think it would have been possible for me to invent APE…
The amount of disagreement this individual testimony is generating is fascinating and frustrating to me. I didn’t think it ever really makes sense to disagree with a comment like this, unless one is claiming that the content of your comment is intentionally untrue. Anyways, appreciate your perspective.
Re: AT&T Syntax versus Intel Syntax (2001)
#79Earlier quoted context omitted.
It's the AT&T syntax because AT&T are the one who unleashed that on the world against the wishes of everyone. See the sibling comment: > The AT&T folks did not even wait for Intel's assembler [...] 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.
Wow, is your bias showing. "Against the wishes of everyone"? How about the wishes of those who wanted an x86 assembler before Intel got around to releasing theirs? And who wanted to be able to not have to switch their brains into a backward syntax when working on an x86?
Re: AT&T Syntax versus Intel Syntax (2001)
#80Similar thing also happens on 68k: Motorola syntax v.s. "MIT" syntax which is probably only used by GNU toolchain
Practically, 68k is far more usable in AT&T syntax than x86. When I used to do PalmPilot development, you could basically write standard 68k asm with just some extra %s sprinkled before registers and as would be fine with it. The x86 AT&T syntax is far more alien compared to the syntax in the official manuals, with arguments backward and nonstandard instruction names like addl and movabsq.