Hello, x86
x86-64 powers most desktops, laptops, and servers shipping today. When someone says "x86", they mean the lineage that started with Intel's 8086 in 1978 and grew into the 64-bit architecture (AMD64, x86-64) underneath nearly everything you touch.
This track teaches you to read and write x86-64 assembly from scratch, with a stubborn focus on security the whole way through.
Why Learn Assembly?
Security work requires assembly, the language sitting underneath everything you'll deal with:
- Reverse engineering - analyzing malware and closed-source binaries
- Exploit development - understanding buffer overflows, ROP chains, and shellcode
- Vulnerability research - finding bugs at the lowest level
- Performance analysis - understanding what the compiler actually produces
- Forensics - reconstructing what a program did on a compromised system
Strip a compiled binary back far enough and what's left is a stream of x86 instructions. Learning assembly is learning to read what your CPU actually does, not what the source code claims it does.
For a broader perspective on why assembly matters, see Why Assembly?.
Intel Syntax and NASM
Two flavours of assembly syntax exist in the wild: Intel and AT&T. We stick with Intel throughout. It reads better, and it's what the security tooling (IDA Pro, Ghidra, the average CTF challenge) speaks by default.
The assembler we'll use is NASM, the Netwide Assembler. NASM eats assembly source and spits out object files, which the linker then turns into runnable binaries.
Intel syntax writes the destination first: mov rax, 5 (put 5 into rax). AT&T syntax writes the source first and decorates operands with sigils: movq $5, %rax. Both produce identical machine code. We use Intel syntax because it is cleaner to read and is the default in most reverse engineering tools.
Your First x86-64 Program
The smallest complete program that prints something and exits without complaints:
; hello.asm - A minimal x86-64 Linux programsection .data msg db "Hello, x86!", 10 ; 10 is the ASCII newline character len equ $ - msg ; calculate the length of the string
section .text global _start
_start: ; sys_write(stdout, msg, len) mov rax, 1 ; syscall number for sys_write mov rdi, 1 ; file descriptor 1 = stdout mov rsi, msg ; pointer to the message mov rdx, len ; number of bytes to write syscall ; invoke the kernel
; sys_exit(0) mov rax, 60 ; syscall number for sys_exit mov rdi, 0 ; exit code 0 = success syscall ; invoke the kernelWalking it line by line:
section .datadefines a section for initialized data. Our message string lives here.dbstands for "define byte" and places raw bytes into the output. The string"Hello, x86!"followed by10(a newline) is laid out byte by byte.equcreates a constant. The expression$ - msgcalculates the distance from the current position to the start ofmsg, giving us the string length automatically.section .textis where executable code lives.global _startmakes the_startlabel visible to the linker. On Linux,_startis the default entry point (notmain- that is a C convention).movcopies a value into a register.mov rax, 1loads the number 1 into the 64-bit registerrax.syscalltransfers control to the Linux kernel to perform an operation.
Building and Running
Assemble, link, run:
nasm -f elf64 hello.asm -o hello.o # assemble into a 64-bit ELF object fileld hello.o -o hello # link the object file into an executable./hello # run it-f elf64 asks NASM for a 64-bit ELF (Executable and Linkable Format) object file, the standard binary format on Linux. ld resolves symbols and stitches everything into the final executable.
Notice that we used _start and syscall directly, with no #include, no printf, and no C library. This produces a minimal binary with no external dependencies. In security work, this matters: shellcode and implants often cannot rely on the C runtime being available or safe to use. Understanding raw syscalls is foundational to exploit development.
What Makes x86-64 Different
Coming from C or Python, assembly feels alien at first. No variables, no types, no functions in the high-level sense, no safety nets to catch you when something goes sideways. What you've got is:
- Registers - a small set of named storage locations inside the CPU
- Memory - raw bytes addressed by number
- Instructions - simple operations like "copy this value" or "add these two numbers"
Strings, arrays, structs, function calls — everything higher-level is a convention you build out of those primitives.
Try It Yourself
Fire up the sandbox below and assemble the hello world program. Swap the message for something else, or change the exit code and verify it with echo $? after running.
Practise on your own machine
You need Linux on x86-64: a virtual machine, WSL 2 on Windows, or a container. Then install the tools with sudo apt install nasm gcc gdb binutils.
What is Next
Next up: registers. Sixteen general-purpose ones, their narrower sub-parts, and the special-purpose registers steering program execution. This is the workspace you'll spend the rest of the track inside.