This book covers assembly language programming for the x86 family of microprocessors. The objective is to teach how to program in x86 assembly, as well as the history and basic architecture of x86 processor family.

When referring to x86 we address the complete range of x86-based processors (since the original Intel 8086 in 1978). This includes:

  • IA-32 assembly, also commonly referred to as x86-32 assembly (Intel architecture 32-bit, since the Intel 80386), a 32-bit extension of the original 16-bit Intel x86 processor architecture (used in Intel 8086 - 80286 CPUs). IA-32 has full backwards compatibility with the 16-bit x86.
  • x86-64, also called the AMD64 or AMD 64-bit extension, backwards compatible with 32-bit code without performance loss.
  • Intel 64, previously named IA-32e or EM64T, almost identical to x86-64.

Throughout the book these terms may be used interchangeably when appropriate. A special notice will be given when covering 16-bit, 32-bit or 64-bit architectures and on any limitations to limit confusion.

Note, that there is a separate 64-bit instruction set, the IA-64 (Itanium). It was meant to replace the x86 line, but did not gain as much popularity as anticipated, so this replacement did not occur.

Table of Contents

  Introduction
  Basic FAQ

x86 Basics

  x86 Family
  x86 Architecture and Register Description
  Comments
  16, 32, and 64 Bits
  Intrinsic Data Types

x86 Instruction Set

  x86 Instructions
  Data Transfer Instructions
  Control Flow Instructions
  Arithmetic Instructions
  Logic Instructions
  Shift and Rotate Instructions
  Other Instructions
  x86 Interrupts

Syntaxes and Assemblers

  x86 Assemblers
  GNU assembly syntax (GAS)
  MASM Syntax
  HLA Syntax
  FASM Syntax
  NASM Syntax

Instruction Extensions

  Instruction Extensions
  Floating Point
  MMX
  SSE
  AVX, AVX2, FMA3, FMA4
  3DNow!

Advanced x86

  Advanced x86
  High-Level Languages
  Machine Language Conversion
  Protected Mode
  Global Descriptor Table
  Advanced Interrupts
  Bootloaders

x86 Chipset

  x86 Chipset
  Direct Memory Access
  Programmable Interrupt Controller
  Programmable Interval Timer
  Programmable Parallel Interface

Embedding and interoperability

  Interfacing with WinAPI (Communicating directly with the operating system from the article GNU assembly syntax (GAS) above)
  Interfacing with Linux
  Calling Conventions (from the Embedded Systems book)
  Calling Conventions (from the x86 Disassembly book)
  Interfacing with the C standard library and own static libraries with CDECL
  Inline Assembler (Embedded Systems book)
  Linked Assembler (Embedded Systems book)

Resources

  Resources