The assembler used by GNAT and gcc is based not on the Intel assembly language, but rather on a language that descends from the AT&T Unix assembler `as' (and which is often referred to as ’AT&T syntax’). The following table summarizes the main features of `as' syntax and points out the differences from the Intel conventions. See the gcc `as' and `gas' (an `as' macro pre-processor) documentation for further information.
gcc / `as': Prefix with ’%’; for example %eax Intel: No extra punctuation; for example eax
gcc / `as': Prefix with ’$’; for example $4 Intel: No extra punctuation; for example 4
gcc / `as': Prefix with ’$’; for example $loc Intel: No extra punctuation; for example loc
gcc / `as': No extra punctuation; for example loc Intel: Square brackets; for example [loc]
gcc / `as': Parentheses; for example (%eax) Intel: Square brackets; for example [eax]
gcc / `as': Leading ’0x’ (C language syntax); for example 0xA0 Intel: Trailing ’h’; for example A0h
gcc / `as': Explicit in op code; for example movw to move a 16-bit word Intel: Implicit, deduced by assembler; for example mov
gcc / `as': Split into two lines; for example
Intel: Keep on one line; for example rep stosl
`Order of operands'
gcc / `as': Source first; for example movw $4, %eax Intel: Destination first; for example mov eax, 4