1 h 20 min · 20 lessons

Assembly 101

Assembly is the layer underneath the C you already write. When you compile int x = a + b;, the compiler emits a handful of instructions — mov, add, mov — that operate directly on the CPU's registers and memory. This course is about reading and writing those instructions yourself. There is no abstraction left below this: assembly is the program, one step removed from the raw bytes the processor executes.

Knowing it changes how you see everything else. A C bug becomes obvious once you can read the three instructions it compiled to; a stripped binary with no source is just assembly you have not read yet. This is the course the Reverse Engineering and Binary Exploitation tracks lean on constantly — every gadget, every patched byte, every crash is assembly.

This course teaches x86-64 assembly in Intel syntax. 32-bit x86 (i386) gets a short differences section near the end; ARM is a separate course. We write Intel, but you will learn to read AT&T too, since gdb and objdump default to it.

Course Layout

The course builds from "how do I even run this" up to reading what an optimizing compiler produced:

  1. Getting Started — the two syntaxes, assembling and linking a program with nasm and ld, and debugging it under gdb. Everything you need to get code running and watch it execute.
  2. Basics — the machine model: binary and hex, the registers, how memory is addressed, and the shape of an instruction.
  3. Operations — doing work: arithmetic, bitwise logic, control flow (jumps and comparisons), the stack and function calls, and talking to the kernel with system calls.
  4. Challenges — write real programs from scratch: Hello, World, a function call, summing an array, and reversing bytes.
  5. 32-bit x86 — the i386 differences you will meet in older binaries and CTF challenges.
  6. Advanced — idioms the compiler loves, how instructions are encoded into bytes, and reading optimized code.

Work the first two sections in order; after that you can jump to whatever you need.

Toolchain

Three tools, all standard on Linux: nasm to assemble, ld to link, and gdb to debug (plus objdump to disassemble). The build is always the same two steps, which we chain into one line:

nasm -f elf64 hello.asm -o hello.o && ld hello.o -o hello && ./helloHello, world!

The Assembling & Linking lesson breaks that line down, and the Debugging Assembly lesson covers stepping through a program instruction by instruction. If gdb is new to you, start with the GDB Guide.

You should already be comfortable writing C.
This course constantly points back to C — "this is what a for loop compiles to," "this is where a local variable lives." You do not need to be an expert, but you should know what a pointer is, how the stack holds local variables, and what a function call does. If that is shaky, work through C Programming first.