Every line of assembly is one instruction — a single operation the CPU performs. A program is just a long list of them, executed top to bottom except where a jump sends execution elsewhere. This lesson is about the anatomy of that line: what it is made of, and how to read one back out of a disassembly.
An instruction is a mnemonic (the operation's name) followed by its operands (what it acts on):
mov rax, 1Here mov is the mnemonic and rax, 1 are the operands. In Intel syntax the destination comes first, so this reads "move 1 into rax." Operands come in three kinds:
rax, bl, rsp1 or 0x40[rbx + 8]Most instructions take two operands (destination, source); some take one (inc rax) or none (syscall).
The workhorse is mov, which copies a value from the source to the destination — register to register, immediate to register, register to memory, or memory to register (but never memory to memory in one instruction). Its close cousin lea computes an address instead of moving data; the two are compared in detail in Memory.
An instruction has to know how many bytes it is operating on. Usually the register names the size — al is 8 bits, ax is 16, eax is 32, rax is 64 — so the same mov mnemonic assembles to a different encoding for each width. Here is mov at all four sizes, disassembled so you can see the bytes:
objdump -d -M intel sizes0000000000401000 <_start>: 401000: b0 11 mov al,0x11 401002: 66 b8 22 22 mov ax,0x2222 401006: b8 33 33 33 33 mov eax,0x33333333 40100b: 48 b8 44 44 44 44 44 movabs rax,0x4444444444444444 401012: 44 44 44 401015: b8 3c 00 00 00 mov eax,0x3c 40101a: bf 00 00 00 00 mov edi,0x0 40101f: 0f 05 syscallLook at the raw bytes in the middle column:
mov al, 0x11 → b0 11 — the 8-bit form, no frills.mov ax, 0x2222 → 66 b8 … — the 66 is an operand-size prefix that switches to 16-bit.mov eax, 0x33333333 → b8 … — 32-bit is the default, so no prefix.mov rax, … → 48 b8 … (shown as movabs) — the 48 is a REX.W prefix that promotes the operation to 64-bit.| Keyword | Size | Example register |
|---|---|---|
| byte | 8 | al |
| word | 16 | ax |
| dword | 32 | eax |
| qword | 64 | rax |
When the operand is memory rather than a register, there is no register to imply the size, so you state it explicitly — mov byte [rbx], 1 versus mov qword [rbx], 1.
Every line of that objdump output has the same three-part shape:
401000: b0 11 mov al,0x11401000: — the address of the instruction in memory.b0 11 — the raw machine-code bytes the CPU actually executes.mov al,0x11 — the human-readable mnemonic and operands.That is the whole game: an address, the bytes living there, and what those bytes mean. Being fluent at reading this line — knowing that b0 11 is mov al, 0x11 — is what the rest of the course trains.
mov al is b0 and the REX prefix is 48 — is covered in Instruction Encoding in the Advanced section.