Docsity

Addressing Modes in Computer Systems Engineering: A Comprehensive Guide, Lecture notes of Systems Engineering

Partial preview of the text

Download Addressing Modes in Computer Systems Engineering: A Comprehensive Guide and more Lecture notes Systems Engineering in PDF only on Docsity!

Addressing Modes

Miscellaneous Lecture by Ali Asghar Manjotho

Lecturer, Department of Computer Systems Engineering, MUET-Jamshoro.

Prerequisite - Introduction to parts of CPU

  • Arithmetic and Logic Unit (ALU)

It performs all the arithmetic and logical

micro operations.

  • Floating Point Unit (FPU)

It performs operations on floating point

numbers.

  • Memory Unit (MU)

It stores the set of instructions.

  • Control Unit (CU)

It supervises the sequence of micro

operations.

  • Registers

Temporary storage area, which holds the

data during the execution of an instruction.

CU FPU MU REGISTERS ALU

Addressing Modes

  • Microprocessor executes the instructions stored in memory (RAM).
  • It executes one instruction at a time.
  • Each of the instruction contains operations and operands.
  • Operation specifies the type of action to be performed.
    • For example: ADD, SUB, MOV, INC, LOAD, STORE
  • Operands are the data on which the operation is to be performed. MOV B, A Here MOV is operation and (B & A) are operands. ADD B Here ADD is operation and (B) is operand.

Addressing Modes

  • Operand can be place either in one of the processor register or in memory.
  • There are different ways to get the operands.
  • The way in which the operand is taken from register or memory is named as addressing mode.
  1. Immediate Addressing Mode
  • The operand is specified with in the instruction.
  • Operand itself is provided in the instruction rather than its address.

Move Immediate

MVI A , 15h A ← 15h Here 15h is the immediate operand

Add Immediate

ADI 3Eh A ← A + 3Eh Here 3Eh is the immediate operand

  1. Register Addressing Mode
  • The operand is specified with in one of the processor register.
  • Instruction specifies the register in which the operand is stored.

Move

MOV C , A C ← A Here A is the operand specified in register

Add

ADD B A ← A + B Here B is the operand specified in register

  1. Register Indirect Addressing Mode MOV A , M A ← [[H][L]] It moves the data from memory location specified by HL register pair to A. 2807 2806 2805 A 2804 2803 2802 2801 2800

A

H 28

L 05

Before 2807 2806 2805 A 2804 2803 2802 2801 2800

A A

H 28

L 05

After A ← [2805] A ← A

  1. Direct Addressing Mode
  • The instruction specifies the direct address of the operand.
  • The memory address is specified where the actual operand is.

Load Accumulator

LDA 2805h A ← [2805] It loads the data from memory location 2805 to A.

Store Accumulator

STA 2803h [2803] ← A It stores the data from A to memory location 2803.

  1. Direct Addressing Mode STA 2803h [2803] ← A It stores the data from A to memory location 2803. 2807 2806 2805 2804 2803 2802 2801 2800

A 9B

Before 2807 2806 2805 2804 2803 9B 2802 2801 2800

A 9B

After [2803] ← A [2803] ← 9B

  1. Indirect Addressing Mode
  • The instruction specifies the indirect address where the effective address of the operand is placed.
  • The memory address is specified where the actual address of operand is placed.

Move

MOV A, 2802h A ← [[2802]] It moves the data from memory location specified by the location 2802 to A.

  1. Implied Addressing Mode
  • It is also called inherent addressing mode.
  • The operand is implied by the instruction.
  • The operand is hidden/fixed inside the instruction.

Complement Accumulator CMA

(Here accumulator A is implied by the instruction)

Complement Carry Flag CMC

(Here Flags register is implied by the instruction)

Set Carry Flag STC

(Here Flags register is implied by the instruction)

  1. Relative Addressing Mode
  • In relative addressing mode, contents of Program Counter PC is added to address part of instruction to obtain effective address.
  • The address part of the instruction is called as offset and it can +ve or – ve.
  • When the offset is added to the PC the resultant number is the memory location where the operand will be placed.
  1. Relative Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F 2800 9F

PC 2803

Offset = 03h Effective address of operand = PC + 01 + offset Effective address of operand = 2803 + 01 + 03 Effective address of operand = 2807h

2806 FF
2805 6D
2802 2E
2801 F
2800 9F

Actual Operand

  1. Indexed Addressing Mode
  • In index addressing mode, contents of Index register is added to address part of instruction to obtain effective address.
  • The address part of instruction holds the beginning/base address and is called as base.
  • The index register hold the index value, which is +ve.
  • Base remains same, the index changes.
  • When the base is added to the index register the resultant number is the memory location where the operand will be placed.