Thinking in x64 Assembly
Thinking in X64
A Programmer’s Introduction to Assembly
Most developers write code without ever thinking about what really happens beneath it. We trust compilers, we trust abstractions, and we get by just fine. But somewhere along the way, you start to wonder: what is the CPU actually doing when it runs my code?
This book is an attempt to answer that. Not just by teaching you assembly, but by showing you how computers actually work at the level where your code becomes reality.
Thinking in X64 takes a practical, first-principles approach to understanding how a modern x86-64 processor executes instructions. Starting from the hardware itself, you’ll build up the mental model needed to read, write, and truly understand assembly code. You’ll learn how simple circuits turn into arithmetic units, how data flows through registers, how control units drive execution, and how memory is addressed and manipulated. Every topic is introduced by asking: what problem is this solving? What would the hardware need to do if we wanted to support this?
If you’ve always wanted to peek behind the curtain of your programming language and see what’s really going on, this book is for you.
Chapters Published So Far
1. First Principles Introduction to Computer Architecture
We build a simple model of how arithmetic and control flow work using basic logic circuits.
2. From Hardware to Assembly We map that hardware model to the structure of assembly programs and understand how everything fits together.
3. Binary Number System and Bitwise Operations
Covers binary encoding and bitwise operations, with focus on how they work at the hardware level.
4. Building (and Breaking) Your First X86 Assembly Program
We translate a minimal C program to assembly and walk through what the compiler usually hides from you.
5. Debugging X86-64 Assembly with GDB
We learn to use GDB to debug assembly programs and identify the root cause behind the mysterious crash of our first assembly program.
Next Up
A deep dive into what system calls are, how they work and how to invoke them from assembly programs.