LOGBOOK

HELP

Quiz Entry - updated: 2026.07.10

What is the mov instruction and what are its forms?

mov copies data from a source to a destination — the most common x86 instruction — but it cannot move directly from one memory location to another.

The legal mov source-destination pairs, with memory-to-memory forbidden.

* mov allows every source/destination pair except memory-to-memory, which must be staged through a register. *

mov is deceptively central: most of what code does is shuffle values between registers, memory, and immediates, and mov is the workhorse for all of it.

mov $imm, reg     # immediate → register
mov $imm, mem     # immediate → memory
mov reg,  reg     # register  → register
mov reg,  mem     # register  → memory
mov mem,  reg     # memory    → register

The one combination that's illegal: memory-to-memory in a single instruction. You must stage through a register:

mov mem, mem      # NOT allowed — use a register as intermediate

Like other instructions, mov takes a size suffix (movb, movw, movl, movq).

Two behaviors worth memorizing: movl into a 32-bit register zeros the upper 32 bits of the 64-bit register, and mov with an immediate is limited to a 32-bit (sign-extended) constant — to load a full 64-bit immediate you need movabs.

Go deeper:

From Quiz: REVE1 / The Processor Interface | Updated: Jul 10, 2026