LearnViz CompSci
Home / Learn / Computer Architecture & Logic / Addressing Modes

Intermediate Topic 24 of 51 Computer Architecture & Logic

Addressing Modes

Ways instructions specify operand locations.

How it works

Addressing modes define how an instruction specifies where its operands are. Common modes include immediate, where the value is encoded in the instruction, register, direct, register indirect, base plus offset or displacement, indexed, and PC-relative. Richer modes let a single instruction access array elements or struct fields, but make decoding and address calculation more complex.

Step-by-step walkthrough

  1. Immediate puts the value inside the instruction.
  2. Register mode names a register that holds the operand.
  3. Direct mode gives the memory address itself.
  4. Indirect mode reads an address from a register or memory first.
  5. Indexed mode adds an offset to a base, ideal for arrays.

Where it is used

Accessing array elements with base plus index, calling functions with PC-relative jumps, loading constants, implementing pointers and writing position-independent code all rely on addressing modes. RISC architectures offer few; x86 offers many.

Common pitfall

Confusing the value in a register with the memory at that address is the classic mistake, as in the difference between loading a pointer and dereferencing it. Offset sizes limit reach, so far jumps need extra steps. Scaling and sign extension rules differ between architectures.

Where it fits in the course

Addressing Modes is topic 24 of 51 in Computer Architecture & Logic, rated Intermediate. It follows Assembly Language. The next topic is Memory Hierarchy.

Practice and explore

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Computer Architecture & Logic quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Addressing Modes?
Ways instructions specify operand locations. It belongs to Computer Architecture & Logic and is an intermediate-level topic.
Where do people use Addressing Modes?
Accessing array elements with base plus index, calling functions with PC-relative jumps, loading constants, implementing pointers and writing position-independent code all rely on addressing modes.
What is the most common mistake with Addressing Modes?
Confusing the value in a register with the memory at that address is the classic mistake, as in the difference between loading a pointer and dereferencing it.
What should I learn before this topic?
Start with Assembly Language, the topic just before it in Computer Architecture & Logic.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Computer Architecture & Logic quiz.
Is Addressing Modes hard to learn?
It is an Intermediate topic. Be comfortable with the Beginner topics in this area first, then read the common pitfall carefully, since it is where most mistakes happen.
How long does it take to learn Addressing Modes?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Addressing Modes?
Assembly Language, Memory Hierarchy, RISC vs CISC are closely connected. The full list is in the related topics section of this page.
What should I study after Addressing Modes?
Continue with Memory Hierarchy, the next topic in Computer Architecture & Logic.

Related topics