Examples of Addressing Modes - 31.3 | 31. Introduction to Addressing Modes | Computer Organisation and Architecture - Vol 1
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.

Interactive Audio Lesson

Listen to a student-teacher conversation explaining the topic in a relatable way.

Understanding Register Initialization and Address Calculation

Unlock Audio Lesson

0:00
Teacher
Teacher

Today, we’re going to learn about how registers work in addressing modes. Let’s start with the values of R1 and R5. Can anyone tell me what initial values we might assign to these registers?

Student 1
Student 1

I think R1 could start at 1, and R5 might be 0?

Teacher
Teacher

That's correct! Now, when we need to calculate an effective memory address, what do we do?

Student 3
Student 3

We add the content of R1 to a displacement value, like 1.

Teacher
Teacher

Exactly. So, if R1 is 1 and we add 1 to it, we get 2. What does this mean for our memory access?

Student 2
Student 2

It means we’re looking at memory location 2.

Teacher
Teacher

Correct! Let’s remember this with the phrase 'Registers guide addresses.' Always think of how the register values lead us to the data we need!

Exploring Indirect and Displacement Addressing

Unlock Audio Lesson

0:00
Teacher
Teacher

Now, let’s discuss indirect addressing. Who can explain how this differs from direct addressing?

Student 4
Student 4

In indirect addressing, we use a memory location to determine where the actual data is stored, while in direct addressing, we go straight to the data location.

Teacher
Teacher

Right! Can you provide an example of using indirect addressing with R1?

Student 1
Student 1

If R1 holds the address of a memory location, say 8000, then we first check what’s in 8000 to get our required data.

Teacher
Teacher

Exactly! And what about displacement addressing?

Student 3
Student 3

In displacement, we add a constant value to the address in our index register to find the data.

Teacher
Teacher

Very good! A mnemonic to help remember this is 'Direct goes, indirect knows!' It reflects how direct goes right to data, but indirect knows to point elsewhere.

Understanding Opcode and Operand Storage in Multiple Word Instructions

Unlock Audio Lesson

0:00
Teacher
Teacher

Let’s tackle the complexities of multiple word instructions. Why are they necessary in certain scenarios?

Student 2
Student 2

Because some opcodes and operands require more bits than available in a single memory word!

Teacher
Teacher

Exactly! For instance, if our instruction requires both opcode and a large address, how would we represent that in an 8-bit architecture?

Student 4
Student 4

We’d need to split it into parts, using the first byte for the opcode and the rest for operands spread over two or more memory locations.

Teacher
Teacher

Correct! This can lead to non-linear program counter movement. Here's a memory aid: 'Split to fit, don’t forget!' Always ensure you can fit your instruction within the memory limits!

Introduction & Overview

Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.

Quick Overview

This section explores various addressing modes used in assembly language, including examples to illustrate indirect, direct, and displacement addressing.

Standard

In this section, we discuss several addressing modes, such as indirect and direct addressing, with a focus on how memory locations are calculated and operated upon. Key examples illustrate complex instructions and the impact of instruction size on memory addressing.

Detailed

Detailed Summary

This section delves into the concept of addressing modes, which are crucial for understanding how data is accessed and manipulated in computer memory through assembly language. Specifically, it covers:

  • Initial Register Values: Discusses the setup of registers, particularly R1 and R5, initializing them to specific values and explaining their role in memory access. The example illustrates how to calculate effective memory locations using the content of R1 plus a displacement value, demonstrating address calculation.
  • Addressing Modes: Examines different modes like indirect, direct, and displacement addressing. For instance, it explains how a value from an array indexed by R1 is accumulated in R5, and how this method utilizes an indirect addressing scheme to link memory locations and registers effectively.
  • Multiple Word Instructions: Introduces the concept of instructions that span multiple memory locations, such as opcode and operand storage in different addresses due to limited instruction size, specifically in the context of an 8-bit data bus and a 16-bit address bus.

Throughout the section, detailed examples showcase the functionality and implications of these addressing modes, underlining their importance in assembly programming.

Youtube Videos

One Shot of Computer Organisation and Architecture for Semester exam
One Shot of Computer Organisation and Architecture for Semester exam

Audio Book

Dive deep into the subject with an immersive audiobook experience.

Understanding Register and Memory Locations

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

So, what is this I am effectively trying to do? So, in this case register 𝑅5 will be 𝑅5 plus what is the content of the memory location how can you find out if whatever is 𝑅1 will be added to the content of the memory location how the memory location is calculated it is content of 𝑅1 + 1.

Detailed Explanation

In this example, we start by explaining how we use registers and memory locations in computations. We focus on register 𝑅5 and the calculation involves adding the value of register 𝑅1 to the content of a specific memory location. The memory location is determined by taking the value of 𝑅1 and adding 1 to it. This means if 𝑅1 holds the value 1, the effective memory location used in this operation will be at 2 (1 + 1).

Examples & Analogies

Imagine you have a drawer (the memory location) where you keep numbered boxes. The index number on the box tells you where to find specific items. If you need to access the items from the box marked 1, you first check what you have in your note (register 𝑅1), find the box next to it (memory location calculated), and then retrieve that specific item to add to your collection (register 𝑅5).

Initial Values and Adding Operands

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

So, now see they are saying that the initial content of 𝑅1 is 1 and 𝑅5 is 0 that is reset and this is one. So, initially the elements of the array may be starting from 1. So, array is the location of the array are starting from memory location 1, 2, 3, 4, 5, 6 and this initially has the value this initially has the value of 0 reset and 𝑅1 has the value of 1.

Detailed Explanation

Here we establish the initial values for the registers and explain the association with array memory locations. Register 𝑅1 starts at 1 and register 𝑅5 starts at 0 (reset). The array is assumed to begin at memory location 1 and contains elements sequentially. Thus, when the first instruction is executed, it accesses memory at index 1 (which holds data), adds it to the current value of 𝑅5 (which is 0), and updates 𝑅5 with the result.

Examples & Analogies

Let's think of your bank account where 𝑅5 represents your total balance (initially 0), and every memory location (like memory slots in an array) is a deposit of money. When you check your note (register 𝑅1) indicating how much to deposit from the first box (memory at index 1), you add that amount to your total balance and update your statement.

Incrementing Registers After Operations

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

Next what you will do you will increment the value of the register number 𝑅1. So, 𝑅1 will be contents of one will be added to the content of R5 that will be done.

Detailed Explanation

After updating 𝑅5 with the value from the memory location, the next step involves incrementing the value in register 𝑅1 by 1. This process allows us to point to the next memory location on the next operation. In essence, this continues the loop of accessing consecutive array elements, modifying 𝑅5 accordingly.

Examples & Analogies

Think of 𝑅1 as a page number in a book you're reading. After you finish one page (operation), you turn to the next page (incrementing 𝑅1) to continue reading and gather more information to add to your notes (updating 𝑅5).

Understanding Indirect Addressing

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

So, this is a simple example of an indirect sorry index addressing mode, it’s again a displacement addressing mode.

Detailed Explanation

In this context, we introduce the concept of indirect or indexed addressing mode, where instruction uses an index or displacement to calculate the effective memory address. This addressing method utilizes registers to navigate through memory more efficiently, allowing for flexibility when accessing data.

Examples & Analogies

Let's visualize a library system where books (data) are sorted by their indexes (registers). Instead of remembering the exact shelf location for each book, you just track which index to look at to find the right shelf, thus organizing your search process.

Multiple Word Instructions and Their Complexity

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

Because in most cases as I was saying that the instruction is basically opcode and some operand or some addresses, but sometimes the size of the instruction cannot be such nice or such of the length of the or the width of the memory cannot be so good that it will hold the whole instruction in 1 word there can be in multiple words.

Detailed Explanation

In this chunk, we discuss how instructions in computing can sometimes exceed the memory storage capacity for a single operation. When instructions become long, they may require splitting across multiple memory words, complicating instruction processing due to their size and organization.

Examples & Analogies

Consider writing a very large research paper. If your paper is too lengthy to fit on a single page, you must spread it over multiple pages. Each page represents a piece of the overall instruction that needs to be pieced together to make sense of your full argument (instruction set).

Definitions & Key Concepts

Learn essential terms and foundational ideas that form the basis of the topic.

Key Concepts

  • Indirect Addressing: An addressing mode where the location of the operand is specified indirectly through a register.

  • Direct Addressing: Accessing data directly by specifying its memory address.

  • Displacement Addressing: A method of computing addresses by adding a constant displacement to an index.

  • Immediate Addressing: The operand is a constant directly provided in the instruction.

  • Multiple Word Instructions: Instructions requiring more than one memory location to store all required data.

Examples & Real-Life Applications

See how the concepts apply in real-world scenarios to understand their practical implications.

Examples

  • An example of indirect addressing is when R1 points to memory address 8000, and we need to retrieve data from there.

  • In displacement addressing, if R4 is 1 and we need to access the content at 8050, we use 8050 + R4 to access 8051.

Memory Aids

Use mnemonics, acronyms, or visual cues to help remember key information more easily.

🎵 Rhymes Time

  • Direct goes, indirect knows; displacement leads where data flows!

📖 Fascinating Stories

  • Imagine R1 as a guide who tells you where to find treasures (data) hidden in memory. Sometimes, he speaks directly to you (direct addressing), sometimes he gives you hints guiding to a location (indirect addressing).

🧠 Other Memory Gems

  • Remember SID: S for direct, I for indirect, D for displacement.

🎯 Super Acronyms

DID

  • Direct
  • Indirect
  • Displacement modes.

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: Addressing Mode

    Definition:

    The method used to specify the location of an operand in memory.

  • Term: Opcode

    Definition:

    The part of an instruction that specifies the operation to be performed.

  • Term: Indirect Addressing

    Definition:

    An addressing mode where the address of the operand is stored in a memory location.

  • Term: Displacement Addressing

    Definition:

    Addressing mode that calculates addresses by adding a constant to an index register.

  • Term: Immediate Addressing

    Definition:

    An addressing mode that uses a constant value directly as an operand.

  • Term: Program Counter (PC)

    Definition:

    A register that contains the address of the next instruction to be executed.