Assembly Language Syntax
Assembly syntax varies slightly depending on the assembler. Two commonly used assembly syntaxes are:
- Intel Syntax: Used in x86 and x86-64 architecture. Operands are written in destination, source order.
- AT&T Syntax: Often used in Unix-like environments. Operands are written in source, destination order.
Intel Syntax Example
mov eax, 10 ; Move 10 into register eax
add eax, 5 ; Add 5 to eax
AT&T Syntax Example
movl $10, %eax ; Move 10 into register eax
addl $5, %eax ; Add 5 to eax
Registers
Registers are small storage units in the CPU. Common x86-64 registers include:
rax: General-purpose register (accumulator).rbx: Base register.rcx: Counter register.rdx: Data register.