Getting started with x86-64

This course is about x86-64, the 64-bit form of x86. x86 is an instruction-set architecture: the family of instructions that a processor understands. An assembly language is a readable way to write those small machine instructions. You already know the general ideas behind instructions, registers, memory, and control flow. Here you will learn the names and conventions of the x86 family.

x86 is a long-lived design. It began with Intel's 8086 processor in 1978, grew from 16 to 32 bits in the 1980s, and gained its 64-bit form through an AMD design introduced in 2003. Newer processors kept much of the older design working. That history is why familiar-looking old names still appear inside modern x86-64 programs.

Why learn it?

x86-64 is common in personal computers, servers, virtual machines, and the tools that support them. Knowing it helps you inspect what a compiler produced, follow a program in a debugger, understand performance-sensitive code, and see how a program interacts with an operating system.

Assembly also gives you a direct view of a program's work. You choose instructions, keep track of values, and follow the changes one instruction at a time. The programs in this course stay small so that view remains useful.

The tools in this course

You will write source code in NASM syntax. NASM is an assembler: it turns the instruction text you write into machine code. Another notation, called AT&T syntax, appears in some online examples and tools, so an x86 instruction found elsewhere may look different while describing the same operation.

The editor runs the assembled programs with blink, in a Linux-style environment. This matters because a program is more than a sequence of calculations: it starts as a process, has a place for its code and data, and can ask the surrounding system to do useful work. The editor lets you build a program, run it, and inspect its state as it executes.

A first look

Here is a complete, runnable program. Focus on the two mov instructions and the add instruction in the middle. The surrounding lines form a template for running the program. Build and run it, then find 42 in rbx in the registers panel.

default rel
global _start

section .text
_start:
    mov rax, 10
    mov rbx, 32
    add rbx, rax

    mov rax, 60
    mov rdi, 0
    syscall

mov puts the two numbers in processor registers, small storage locations inside the CPU. add adds them, leaving the result in rbx. You will learn how the template works through the course.

The route ahead

The introduction establishes the x86-64 building blocks: registers and memory, how values are represented, the instruction set, addresses, flags, and the layout of a source file.

After that, the course has three main parts:

  • Think in assembly develops comparisons, branches, loops, arithmetic, data structures, the stack, and subroutines into complete program logic.
  • Talking to the outside world shows how an x86 program works with Linux and the wider machine.
  • Examples brings the pieces together in practical programs, from moving data and working with arrays to recursion, sorting, searching, and printing.

By the end, you will be able to read and write compact x86-64 programs with a clear sense of what each instruction asks the machine to do.

Instructions in this lesson

movaddsyscall