Intel syntax (as opposed to AT&T syntax) is an x86 assembly syntax using "opcode dst, src", square brackets for memory operands, and keywords to set the size of an operand: e.g. add dword [eax], 123. There are two main flavours of Intel syntax: NASM-style and MASM/TASM-style.
Intel Syntax is used in Intel's (and AMD's) manuals, and by many assemblers. See the x86 tag wiki for links to those and to assembler manuals.
The other major syntax for x86 assembly is AT&T (att). Other syntaxes include HLA, and the Go assembler's x86 syntax (which looks like 16-bit, using AX to actually mean AL/AX/EAX/RAX depending on the operand-size).
All flavours of Intel Syntax share these characteristics:
- Parameter order: destination <- source.
pinsrd xmm0, eax, 2
- Square brackets indicate a memory operand:
add eax, [esi]
(but beware the differences between NASM and MASM for symbols,offset
vs. just omitting the[]
). - Operand size: implied by a register name, or specified explicitly with
dword
(NASM) ordword ptr
(MASM) in instructions with no register operand.
add qword [fs:rdi + r10], 123
. (Put the size operator on the memory operand.) - Immediate values and other numeric constants: No
$
prefix. For hex, use a trailingh
, and make sure the number starts with a0
. e.g.0deadbeefH
. Some Intel-syntax assemblers (e.g. NASM) also support C-style0xdeadbeef
constants, but all support trailing-h. Binary constants can use ab
suffix.
The two major flavours of Intel syntax are NASM-style and MASM/TASM style.
How to know if an assembly code has particular syntax (emu8086, NASM, TASM, ...)?
and x86, difference between BYTE and BYTE PTR
The GNU assembler, as
/gas (and compatible ones like clang's built-in assembler) supports a .intel_syntax noprefix
directive to switch to a mode with MASM-like syntax. There isn't official documentation for GAS's intel-syntax. See also Distinguishing memory from constant in GNU as .intel_syntax. If you're not sure, encode the machine-code you want somehow (e.g. using another assembler) and disassemble in Intel syntax with objdump -drwC -Mintel
.
- MASM: when
[]
is ignored, and how to get addresses as immediate constants. Confusing brackets in MASM32 - Assembly difference between [var], and var for NASM vs. MASM.