X86 Assembly/X86 Instructions

From Wikibooks, open books for an open world
Jump to: navigation, search

These pages will discuss, in detail, the different instructions available in the basic x86 instruction set. For ease, and to decrease the page size, the different instructions will be broken up into groups, and discussed individually.

For more info, see the resources section.

Conventions[edit]

The following template will be used for instructions that take no operands:

Instr

The following template will be used for instructions that take 1 operand:

Instr arg

The following template will be used for instructions that take 2 operands. Notice how the format of the instruction is different for different assemblers.

Instr src, dest GAS Syntax
Instr dest, src Intel syntax


The following template will be used for instructions that take 3 operands. Notice how the format of the instruction is different for different assemblers.

Instr aux, src, dest GAS Syntax
Instr dest, src, aux Intel syntax

Suffixes[edit]

Some instructions, especially when built for non-Windows platforms (i.e. Unix, Linux, etc.), require the use of suffixes to specify the size of the data which will be the subject of the operation. Some possible suffixes are:

  • b (byte) = 8 bits
  • w (word) = 16 bits
  • l (long) = 32 bits
  • q (quad) = 64 bits

An example of the usage with the mov instruction on a 32-bit architecture, GAS syntax:

    movl $0x000F, %eax          # Store the value F into the eax register