|
There are much more differences (sources: http://www.imada.sdu.dk/Courses/DM18/Litteratur/IntelnATT.ht..., http://stackoverflow.com/a/9951916/497193) In Intel syntax instructions are not suffixed. In AT&T there is a suffix (q, d, w, b) depending on the operand size. For example (assuming 32 bit register) mov (Intel) gets movl (AT&T). Also the argument order is changed. Constants have to be prefixed by $. Hexadecimal values are prefixed with 0x instead of suffixed with h. Registers are prefixed with %. With this we already have mov eax,1
mov ebx,0ffh
vs. movl $1,%eax
movl $0xff,%ebx
But also the notation for accessing memory is different: For encoding the SIB (Scaled Index Byte) (+ disp[lacement], if desired), Intel uses [base+disp+index * scale], while AT&T uses disp(%base, %index, scale). Thus we have mov edx, [ecx]
mov eax, [ebp-4]
mov eax, [ebp-4+edx*4]
lea eax, [eax*4+8]
lea eax, [eax*2+eax]
vs. movl (%ecx), %edx
movl -4(%ebp), %eax
movl -4(%ebp, %edx, 4), %eax
leal 8(,%eax,4), %eax
leal (%eax,%eax,2), %eax
Edit: On the other hand, when the size of the operand can't be concluded from the instruction, in Intel syntax you have to add 'BYTE PTR', 'WORD PTR', 'DWORD PTR' or 'QWORD PTR' to disambiguate the situation. For example mov [ebx], 2
is not unique, so in Intel's syntax you have to write respectively mov BYTE PTR [ebx], 2
mov WORD PTR [ebx], 2
mov DWORD PTR [ebx], 2
|
movl -4(%ebp), %eax
is intuitive to me. On the Motorola MC68000 family, it would have been
move.l -4(sp), a0
so I can hit the ground running with AT & T syntax.
The first time I saw
mov eax, [ebp-4]
I wanted to take a hammer and beat the idiotic IBM PC tin-bucket into oblivion. Did the square brackets have any special meaning? Who the hell knows! What do they mean?!? Completely unintuitive.
With AT & T syntax, I can even hit the ground running reading SPARC assembler:
mov 5, %g31
moves five to global register 31. Perfectly logical and intuitive, and I didn't even have to know anything about SPARC assembler.
Then there is the deadbeefh instead of $deadbeef or 0xdeadbeef syntax. Everybody else either used $deadbeef or 0xdeadbeef, but not intel, oh no! intel just had to be different. Irritating to no end. Again, taking a hammer to the PC bucket was a temptation...
Only intel could come up with something which does not relate to anything.