MOV and Data Transfer Instructions
You'll learn: How to move data between registers, memory locations, and immediate values using the fundamental MOV instruction and related data transfer operations.
What Are Data Transfer Instructions?
Think of registers as small clipboards on your desk and memory as filing cabinets across the room. Data transfer instructions are like picking up a piece of paper and moving it from one place to another—you're not doing math or making decisions, just relocating information.
The MOV (move) instruction is the workhorse of assembly language. Despite its name, it actually copies data from a source to a destination, leaving the original intact.
Basic MOV Syntax
MOV destination, source
The instruction reads right-to-left: take what's in the source and copy it to the destination.
Common Transfer Patterns
Register to Register:
MOV R1, R2 ; Copy contents of R2 into R1
Immediate to Register:
MOV R1, #42 ; Load the value 42 directly into R1
Memory to Register (Load):
MOV R1, [address] ; Load value from memory address into R1
Register to Memory (Store):
MOV [address], R1 ; Store R1's value into memory address
Why It Matters
Every program needs to shuffle data around—loading inputs, saving results, preparing operands for calculations. The ALU can't add two numbers stored in memory; you must first move them into registers where the CPU can work with them efficiently.
Key Takeaway: MOV instructions copy data between registers, memory, and immediate values—they're the fundamental building blocks that set up all other computations in assembly language.