I wrote this course for developers who already program in C99 and want to see what the compiler turns their code into. Rather than treating x86-64 as an abstract list of mnemonics to memorize, I approach it as a working tool: reading gcc -S output, inspecting registers and memory dumps in GDB, tracing syscalls with strace, and measuring instruction costs on real hardware.

Course Repository and CI

Each lesson focuses on a single core idea, comes with a small, reproducible testbed and is verified against real terminal output. All source code, C99 tests, and the CI matrix live in the asm-course repository: github.com/b1sted/asm-course.

For the full list of lessons with links to articles and source directories, environment requirements, and build commands, see the repository README.

Course Roadmap

The course is split into four stages, ramping up in complexity gradually. In stage one, you run a ready-made _start template, read registers, and pause the process in GDB. Memory, the stack, and calling conventions only appear once the terminal, nasm, and gdb -batch have become second nature—so the early lessons don’t require holding all of x86-64 in your head at once.

Stage 1 · 00–05
Registers & GDB

Stage 2 · 06–11
Data & Stack

Stage 3 · 12–16
OS & Algorithms

Stage 4 · 17–28
C99, ABI & Hardware

Stage 1 · 00–05
Registers & GDB

Stage 2 · 06–11
Data & Stack

Stage 3 · 12–16
OS & Algorithms

Stage 4 · 17–28
C99, ABI & Hardware

Fig. 1. The four stages of the course: from your first run to reading compiler output
  1. Orientation, basic instructions, and your first GDB session (00–05). Lessons 00–02 focus primarily on tooling: the path from C99 to a binary, how an object file differs from an ELF executable, and how to inspect ELF files using six utilities. To avoid testing tools on contrived dummy files, real instructions and directives appear in the examples right away, though you don’t need to memorize them yet—just pay attention to how the tools work. Registers, your first syscall, and step-by-step debugging in GDB start systematically in lessons 03–05.

  2. Data, memory, addressing, branching, and the stack (06–11). This stage introduces bytes in .data and .bss, little-endian byte order, RFLAGS, conditional jumps, the stack, rbp stack frames, and array addressing. Understanding memory and the stack is the foundation for everything that follows, so this stage spans six lessons.

  3. The OS boundary, system calls, and register-level algorithms (12–16). Programs step outside their own sections: opening files, reading command-line arguments, converting strings and numbers, and handling 128-bit arithmetic and floating-point math.

  4. Bridging to C99, ABI conventions, the compiler, hardware, and diagnostics (17–28). Dynamic linking and PLT/GOT, the System V ABI, reading gcc -O0/-O2 output, the CPU pipeline and SIMD, allocators built on mmap, atomic operations, reference tables, and debugging common crashes.


Version 2. This course grew out of my NASM articles published in 2025. Back then, they were standalone practical guides that gradually accumulated new drafts, C99 testbeds, gcc output breakdowns, and hardware benchmarks. Version 2 pulls all of that material into a single end-to-end track from CLI tools down to the CPU pipeline, verified in CI, with all previous post URLs preserved and redirected to the corresponding lessons.

Orientation and Building

3
Why read assembly, the toolchain, and the path to an ELF

First Instructions and the Debugger

3
Registers, mov, the first program, and GDB

Data, Control Flow, and Memory

6
Sections, flags, branches, the stack, functions, and arrays
• ⏱ 13 min read

Bytes in Memory: .rodata, .data, .bss, and Little-Endian

How .rodata, .data, and .bss differ on disk and after loading, why 0x11223344 sits in memory as 44 33 22 11, and how to verify it with readelf, stat, and GDB.

• ⏱ 15 min read

Arithmetic, Bits, and RFLAGS: ZF, SF, CF, and OF

How add, sub, cmp, and test set ZF, SF, CF, and OF, why inc leaves carry alone, how shift counts are masked by width, and how to read flags in GDB.

• ⏱ 15 min read

Branching and Loops: rip, jmp, jcc, and Unrolling for/while

How rip picks the next address, why jg and ja diverge on identical bytes, what for and while lower to, and what CPU counters say about loop vs. dec + jnz.

• ⏱ 14 min read

Virtual Memory and the Stack: rsp, push, pop, and the Red Zone

How rsp moves the stack boundary, what push actually does, why the red zone exists, and why infinite recursion crashes on a guard page instead of swapping.

• ⏱ 12 min read

Functions and Recursion: call, ret, rbp Frames, and Tail Calls

How call and ret transfer control via the stack, why functions build an rbp frame, what callee-saved registers are, and how tail recursion compiles down to a loop.

• ⏱ 12 min read

Arrays, Structs, and SIB Addressing: [base + index*scale + disp]

How the CPU computes an element’s address via base + index*scale + disp, how lea differs from mov, and why an array parameter in C99 decays to a pointer.

The OS Boundary and Algorithms Under the Hood

5
Syscalls, argv, strings, 128-bit arithmetic, and IEEE 754

C99 ↔ x86-64: Linking, ABI, and Reading Compiler Output

3
Symbols, PLT/GOT, the System V ABI, and gcc -S

How Hardware Actually Works

4
The pipeline, SIMD, virtual memory, and atomics

Reference and Diagnostics

5
Cheat sheets, the ISA matrix, common errors, and profiling