When looking online for references online, you may come across two different types of syntax for x86 assembly. Below is a summary of the major differences between Intel and AT&T syntax. You will be using AT&T assembly in your projects, however a majority of online references use Intel syntax.
INTEL | AT&T |
Immediates are written as is, e.g. 3 is written as 3 | Immediates have a $ in front, 3 is written as $3 |
Order of src and destination: mov dest src |
AT&T is reversed: movl src dest |
Instructions don't have the size of their operands in the opname | Instructions are followed by l for 32-bit operations,
w for 16-bit operations and b for 8-bit
operations. e.g. movl %ebx, %eax # move 32 bit value from ebx -> eax |
Memory references in Intel are written: [ base + index * scale + displacement ] Base and index are registers, while scale and displacement are immediate values. |
AT&T Syntax, references are written as: displacement(base, index, scale) |
Example: mov ebx, eax mov ecx, [ebx + eax*4] |
movl %eax, %ebx movl (%ebx,%eax,$4), %ecx |
Last modified: 10/22/2003 3:50 AM