Addressing Modes - 3.3 | Experiment No. 4: Introduction to 8086 Microprocessor - Architecture and Addressing Modes | Microcontroller Lab
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.

Immediate Addressing Mode

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Let's start by discussing the immediate addressing mode. In this mode, the operand is specified directly within the instruction. For instance, when we write `MOV AX, 5000H`, it means we're loading the value `5000H` directly into AX without needing any memory fetch.

Student 1
Student 1

Why is immediate addressing useful?

Teacher
Teacher

Great question! Immediate addressing is very efficient for loading constant values, as it avoids the delay of memory access. Can anyone give me another example of immediate addressing?

Student 2
Student 2

Like `MOV BX, 1234H`?

Teacher
Teacher

Exactly! That's a perfect example. Now remember, since immediate values are part of the instruction itself, they occupy space in the opcode. This can help streamline certain operations.

Student 3
Student 3

So, do we need to calculate addresses for immediate values?

Teacher
Teacher

Correct! There’s no need for addressing calculations because we use the value directly. Let's summarize: immediate addressing is effective for constant loads, and it allows quick data assignments.

Register Addressing Mode

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Moving on, we have register addressing mode. Here, both the source and destination are registers. For example, in `MOV AX, BX`, the contents of BX are transferred to AX.

Student 2
Student 2

Isn’t that the fastest way to move data since it's all within the CPU?

Teacher
Teacher

Absolutely! Register-to-register transfers are the quickest. They avoid memory fetch delays. Can anyone think of a scenario where we'd frequently use this?

Student 4
Student 4

In loops, where we keep updating a counter or temp value?

Teacher
Teacher

Yes! When performing arithmetic operations, we often use register addressing to store intermediate computations. It's a critical operation for fast algorithms.

Student 1
Student 1

Can we mix different types of registers?

Teacher
Teacher

Not usually. It's best practice to transfer between registers of the same size, like AX with BX. To conclude, remember: register addressing is key for fast data manipulation within assembly routines.

Direct Addressing Mode

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Next, let’s explore direct addressing. This addresses specific memory locations directly, as seen in `MOV AX, [1234H]`. This means we read from the memory address calculated using DS as the segment register.

Student 3
Student 3

How do we ensure DS points to the right memory before using direct addressing?

Teacher
Teacher

Great point! Before any direct memory access, we need to initialize DS with the correct data segment. Otherwise, we could read the wrong value. Does anyone have another example of direct addressing?

Student 4
Student 4

What about accessing a variable, like `MOV AX, MY_VAR`?

Teacher
Teacher

Exactly, `MY_VAR` gets translated to its direct offset in the data segment. So if MY_VAR is located at DS:1234H, it will fetch from there. Remember, while direct addressing is straightforward, it’s less flexible than other modes for variable access.

Student 1
Student 1

Can we use direct addresses for constants too?

Teacher
Teacher

Not directly; those typically use immediate addressing. In summary, direct addressing plays a vital role in accessing pre-defined memory locations quickly.

Introduction & Overview

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

Quick Overview

This section discusses the various addressing modes of the 8086 microprocessor, detailing how operands are accessed in memory.

Standard

The section explores the different addressing modes supported by the 8086 microprocessor, explaining how each mode calculates the effective address of an operand. It highlights immediate, register, direct, indirect, based, indexed, based-indexed, and string addressing modes, providing syntax examples and application scenarios for each mode.

Detailed

Addressing Modes in the 8086 Microprocessor

The 8086 microprocessor offers various addressing modes that define how an effective address for an operand is calculated, allowing for enhanced flexibility and efficiency in accessing data. These addressing modes include:

  1. Immediate Addressing Mode: The operand value is specified directly in the instruction, meaning no memory access is required for the operand. For example, MOV AX, 5000H directly loads 5000H into register AX.
  2. Register Addressing Mode: The operand is located within one of the internal registers of the 8086. An example is MOV AX, BX, which copies the contents of BX into AX. This mode is useful for fast data transfers.
  3. Direct Addressing Mode: The instruction specifies the effective address (offset) directly. For instance, MOV AX, [1234H] accesses the memory at segment:offset calculated using the data segment (DS) as the segment register.
  4. Register Indirect Addressing Mode: The effective address is held in a pointer register (such as BX, BP, SI, or DI). For example, MOV AX, [BX] copies data from the address contained in BX.
  5. Based Addressing Mode: This mode calculates the effective address by adding a fixed displacement to a base register (BX or BP). For example, MOV AX, [BX + 10H] reads data at (BX + 10H).
  6. Indexed Addressing Mode: Effective address calculation here involves an index register (SI or DI) with an added displacement. An example is MOV AX, [SI + 20H], accessing data at SI + 20H.
  7. Based-Indexed Addressing Mode: The effective address combines a base register with an index register while optionally including a displacement. For example, MOV AX, [BX + SI + 30H] fetches data from the result of the expression.
  8. String Addressing Mode: This mode is implicitly used with string instructions, where the source index (SI) is used for the source address and destination index (DI) for the destination address. For example, MOVSB moves a byte from DS:SI to ES:DI.

Understanding these addressing modes is crucial for efficient programming in 8086 assembly, as they influence how data is accessed and manipulated in memory.

Audio Book

Dive deep into the subject with an immersive audiobook experience.

Overview of Addressing Modes

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

Addressing modes define how the effective address of an operand is calculated. The 8086 supports various addressing modes, providing flexibility and efficiency in accessing data.

Detailed Explanation

Addressing modes are crucial in assembly language because they determine how the processor locates the data that instructions will operate on. The 8086 microprocessor has various addressing modes which allow programmers to access memory and registers in different ways, enhancing the capability to write flexible and efficient programs.

Examples & Analogies

Think of addressing modes like different ways to find a book in a library. You can search by title (immediate mode), go directly to a specific shelf (direct addressing), or refer to a librarian for where a particular book is located (indirect addressing). Each method has its advantages and applications, just as different addressing modes do in programming.

Immediate Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Immediate Addressing Mode:
  2. The operand is a part of the instruction itself. No memory access is required for the operand.
  3. Syntax: MOV AX, 5000H (Loads the value 5000H directly into AX).
  4. Use Case: Loading constant values into registers.

Detailed Explanation

In immediate addressing mode, the value you want to use is included directly in the instruction with no need to refer to any memory location. For example, when you see 'MOV AX, 5000H', the value 5000H is placed in the AX register directly, making it easy and fast to use constant values without additional memory accesses.

Examples & Analogies

Imagine you have a recipe that calls for a constant amount of salt. Instead of going to your pantry to look for it, you just take the amount from the table directly where you placed it. Similarly, immediate addressing allows instant access to a constant value specified in the instruction.

Register Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Register Addressing Mode:
  2. The operand is located in one of the 8086's internal registers.
  3. Syntax: MOV AX, BX (Copies the content of BX into AX).
  4. Use Case: Fast data transfer between registers, arithmetic/logic operations on register data.

Detailed Explanation

In register addressing mode, the operand is stored in one of the internal registers of the CPU. This allows for quick data handling as registers are much faster than accessing memory. For example, if you’re moving data from one register to another, like in 'MOV AX, BX', you're essentially copying values without any time delay related to memory access.

Examples & Analogies

Imagine you have two boxes on your desk, and you want to transfer an item from one box to another. Since the boxes are right next to each other, you can do this very quickly. Register addressing is like moving items between two boxes that are immediately accessible, making the transfer fast.

Direct Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Direct Addressing Mode:
  2. The operand's effective address (offset) is directly specified as part of the instruction. The physical address is calculated using DS as the segment register.
  3. Syntax: MOV AX, [1234H] (Copies the word from memory location DS:1234H into AX).
  4. Use Case: Accessing fixed memory locations, global variables.

Detailed Explanation

Direct addressing mode is when the instruction specifies the exact memory address where the operand is stored. The CPU accesses the memory directly using a segment register and offset. For instance, 'MOV AX, [1234H]' tells the microprocessor to look at the memory location represented by the data segment and the offset 1234H to fetch the value directly into AX.

Examples & Analogies

Imagine you have a filing cabinet with labelled folders. If you know exactly which folder (memory address) to look in for the information you need, you can go straight to it. Direct addressing is like knowing precisely where to find something in your cabinet without searching through every folder.

Register Indirect Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Register Indirect Addressing Mode:
  2. The effective address of the operand is held in one of the pointer or index registers (BX, BP, SI, DI). The default segment register is DS for BX, SI, DI, and SS for BP.
  3. Syntax: MOV AX, [BX] (Copies the word from memory location DS:BX into AX).
  4. Use Case: Accessing data from an array or a list where the starting address is in a register and the offset changes.

Detailed Explanation

In register indirect addressing mode, the address of the operand is stored in a register. This is very useful for operations involving arrays and lists, where you use a register to point to the current position in memory. For instance, with 'MOV AX, [BX]', BX holds the address of the value you want to read, allowing for efficient data retrieval.

Examples & Analogies

Think of a conveyor belt in a factory where items are placed on specific sections. Instead of knowing where every item is located, you have an operator (the register) pointing to the current item on the belt (the address). The operator can shift to different sections swiftly as needed, similar to how register indirect addressing dynamically accesses different memory addresses.

Based Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Based Addressing Mode:
  2. The effective address is calculated by adding a displacement (8-bit or 16-bit) to the contents of a base register (BX or BP).
  3. Syntax: MOV AX, [BX + 10H] or MOV AX, 10H[BX] (Copies the word from DS: (BX + 10H) into AX).
  4. Use Case: Accessing elements of a record or structure, where BX points to the base of the record and 10H is the offset of a specific field.

Detailed Explanation

Based addressing allows the CPU to calculate the operand's address by adding a fixed offset to a base register. This mode is particularly handy when dealing with records, as you can easily navigate through fields in a structured way. For example, 'MOV AX, [BX + 10H]' means take the base address in BX and go 10H bytes forward to find the required value.

Examples & Analogies

Imagine you’re reading a book where each chapter starts at a different page number. The base register (BX) tells you the start of the book, and the displacement (10H) tells you how many pages to move forward. This way, you can quickly jump to any chapter by just adding a few pages to the starting point.

Indexed Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Indexed Addressing Mode:
  2. The effective address is calculated by adding a displacement (8-bit or 16-bit) to the contents of an index register (SI or DI).
  3. Syntax: MOV AX, [SI + 20H] or MOV AX, 20H[SI] (Copies the word from DS: (SI + 20H) into AX).
  4. Use Case: Similar to based addressing, used for accessing array elements or structures.

Detailed Explanation

Indexed addressing mode allows the effective address of an operand to be computed by combining a base address stored in an index register with an additional offset. This is especially useful for traversing arrays where the index can change during execution. In 'MOV AX, [SI + 20H]', SI provides the base address and 20H dictates how far to go to find your value.

Examples & Analogies

Consider a buffet where each dish is placed in a row. You know where row one starts (the index register), and you can add how many dishes down the row you want to go (the displacement). This way, you can efficiently go directly to the dish you want without looking at every dish in the row.

Based-Indexed Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. Based-Indexed Addressing Mode:
  2. The effective address is calculated by adding the contents of a base register (BX or BP) and an index register (SI or DI), plus an optional displacement.
  3. Syntax: MOV AX, [BX + SI] or MOV AX, [BX + SI + 30H] (Copies the word from DS: (BX + SI + 30H) into AX).
  4. Use Case: Accessing elements in two-dimensional arrays, where BX might hold the base address of a row and SI holds the offset within the row.

Detailed Explanation

In basis-indexed addressing mode, the effective address is formulated by combining the base address from a base register and an index address, often used in two-dimensional array scenarios. The syntax 'MOV AX, [BX + SI]' means the instruction is getting the value from a memory address calculated by considering both BX and SI, making it very powerful for working with data structures.

Examples & Analogies

Imagine a library where books are arranged in rows, and each row contains several shelves of books. The base register can indicate which row to go to, while the index register can tell you exactly which shelf within that row to check. This allows you to efficiently find books in a multi-dimensional setup like a two-dimensional array.

String Addressing Mode

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

  1. String Addressing Mode:
  2. Used by string instructions (e.g., MOVS, CMPS, SCAS, LODS, STOS). SI is implicitly used for the source address (DS:SI) and DI for the destination address (ES:DI). After each operation, SI and DI are automatically incremented or decremented based on the Direction Flag (DF).
  3. Syntax: MOVSB (Moves a byte from DS:SI to ES:DI).
  4. Use Case: Efficient block memory transfers.

Detailed Explanation

String addressing mode is tailored for operations involving blocks of data, like arrays. It automates the movement of strings from one memory location to another, using optimized instructions to handle multiple bytes in one go by implicitly incrementing the SI and DI registers. For example, the instruction 'MOVSB' moves a byte from the source address in DS:SI to the destination address in ES:DI, making data handling swift and efficient.

Examples & Analogies

Think of this mode like a factory assembly line where items move from one station to another. The factory workers (the registers SI and DI) automatically move to the next item after they process each one, allowing for smooth, continuous operation. This is how string addressing helps with efficient data copying and processing in bulk.

Definitions & Key Concepts

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

Key Concepts

  • Immediate Addressing Mode: Directly encodes the operand in the instruction without requiring memory access.

  • Register Addressing Mode: Operands are located in the CPU's registers, allowing speedy data transfers.

  • Direct Addressing Mode: Specifies the effective address directly in the instruction for accessing specific memory locations.

  • Register Indirect Addressing: Effective address held in pointer/index registers for flexibility in data access.

  • Based Addressing Mode: Incorporates a fixed displacement added to a base register for effective address calculation.

  • Indexed Addressing Mode: Uses the contents of an index register and a displacement for effective addressing.

  • Based-Indexed Addressing Mode: Combines base register and index register plus a displacement for complex memory access.

  • String Addressing Mode: Used with string instructions to handle data within source and destination addresses.

Examples & Real-Life Applications

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

Examples

  • Immediate Addressing: MOV AX, 5000H loads the constant 5000H into register AX directly.

  • Register Addressing: MOV AX, BX transfers the contents of register BX into AX.

  • Direct Addressing: MOV AX, [1234H] fetches a value from the physical address 1234H.

  • Register Indirect Addressing: MOV AX, [SI] uses the value in SI to determine the address being accessed.

  • Based Addressing: MOV AX, [BX + 10H] reads data located at the address in BX plus offset 10H.

  • Indexed Addressing: MOV AX, [SI + 20H] accesses data based on the current value of SI plus an offset.

  • Based-Indexed Addressing: MOV AX, [BX + SI + 30H] calculates the address by adding BX, SI, and an offset.

  • String Addressing: MOVSB moves a byte from DS:SI to ES:DI with SI and DI auto-incrementing.

Memory Aids

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

🎵 Rhymes Time

  • Immediate mode is fast, no memory needs to be accessed last.

📖 Fascinating Stories

  • Imagine a post office where each letter (operand) is addressed directly to a mailbox (instruction), symbolizing immediate addressing where no extra routing is required.

🧠 Other Memory Gems

  • I Raise Deadly Robins In String: I - Immediate, R - Register, D - Direct, R - Register Indirect, I - Indexed, S - String.

🎯 Super Acronyms

M-RSID

  • Memory
  • Register
  • Segment
  • Index
  • Direct to recall addressing modes.

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: Immediate Addressing Mode

    Definition:

    An addressing mode where the operand value is encoded directly in the instruction, requiring no memory access.

  • Term: Register Addressing Mode

    Definition:

    An addressing mode where the operand is located in one of the CPU's registers, allowing fast data access.

  • Term: Direct Addressing Mode

    Definition:

    An addressing mode that specifies the effective address of the operand directly in the instruction.

  • Term: Register Indirect Addressing

    Definition:

    An addressing mode where the operand's effective address is held in one of the pointer or index registers.

  • Term: Based Addressing Mode

    Definition:

    An addressing mode that calculates the effective address by adding a fixed displacement to the contents of a base register.

  • Term: Indexed Addressing Mode

    Definition:

    An addressing mode that uses an index register whose contents are added to a displacement to generate an effective address.

  • Term: BasedIndexed Addressing Mode

    Definition:

    An addressing mode that calculates the effective address by adding the contents of a base register and an index register, with an optional displacement.

  • Term: String Addressing Mode

    Definition:

    An addressing mode used with string manipulation instructions, utilizing specific registers for source and destination addresses.