SlideShare a Scribd company logo
1 of 39
Download to read offline
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
Ali Asghar Manjotho, Lecturer CSE-MUET
Prerequisite - Registers inside CPU
A (8-bit)
B (8-bit) C (8-bit)
D (8-bit) E (8-bit)
H (8-bit) L (8-bit)
PC (16-bit)
SP (16-bit)
S Z
A
C P
C
Y
General Purpose Registers
Index Registers
Accumulator Flag Register / Program Status Word (PSW)
S = Sign, Z = Zero, CY = Carry,
AC = Auxiliary Carry, P = Parity,
Ali Asghar Manjotho, Lecturer CSE-MUET
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.
Ali Asghar Manjotho, Lecturer CSE-MUET
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.
Ali Asghar Manjotho, Lecturer CSE-MUET
Addressing Modes
1. Immediate Addressing Mode
2. Register Addressing Mode
3. Register Indirect Addressing Mode
4. Direct Addressing Mode
5. Indirect Addressing Mode
6. Implied Addressing Mode
7. Relative Addressing Mode
8. Indexed Addressing Mode
9. Base Register Addressing Mode
10. Autoincrement or Autodecrement Addressing Mode
Ali Asghar Manjotho, Lecturer CSE-MUET
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
Ali Asghar Manjotho, Lecturer CSE-MUET
2. 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
Ali Asghar Manjotho, Lecturer CSE-MUET
3. Register Indirect Addressing Mode
• The instruction specifies the register in which the memory
address of operand is placed.
• It do not specify the operand itself but its location with in the
memory where operand is placed.
Move
MOV A , M A ← [[H][L]]
It moves the data from memory location specified by HL register pair to A.
Ali Asghar Manjotho, Lecturer CSE-MUET
3. 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 A9
2804
2803
2802
2801
2800
A
H 28
L 05
Before
2807
2806
2805 A9
2804
2803
2802
2801
2800
A A9
H 28
L 05
After
A ← [2805] A ← A9
Ali Asghar Manjotho, Lecturer CSE-MUET
4. 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.
Ali Asghar Manjotho, Lecturer CSE-MUET
4. Direct Addressing Mode
LDA 2805h A ← [2805]
It loads the data from memory location 2805 to A.
2807
2806
2805 5C
2804
2803
2802
2801
2800
A
Before
2807
2806
2805 5C
2804
2803
2802
2801
2800
A 5C
After
A ← [2805] A ← 5C
Ali Asghar Manjotho, Lecturer CSE-MUET
4. 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
Ali Asghar Manjotho, Lecturer CSE-MUET
5. 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.
Ali Asghar Manjotho, Lecturer CSE-MUET
5. Indirect Addressing Mode
MOV A, 2802h A ← [[2802]]
It moves the data from memory location specified by the location
2802 to A.
2807
2806 FF
2805
2804
2803 06
2802 28
2801
2800
A
Before
2807
2806 FF
2805
2804
2803 06
2802 28
2801
2800
A FF
After
A ← [[2802]] A ← FF
Ali Asghar Manjotho, Lecturer CSE-MUET
6. 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)
Ali Asghar Manjotho, Lecturer CSE-MUET
7. 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.
Ali Asghar Manjotho, Lecturer CSE-MUET
7. Relative Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
PC 2801
Offset = 04h
Effective address of operand = PC + 01 + offset
Effective address of operand = 2801 + 01 + 04
Effective address of operand = 2806h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
Actual Operand
Ali Asghar Manjotho, Lecturer CSE-MUET
7. Relative Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
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
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
Actual Operand
Ali Asghar Manjotho, Lecturer CSE-MUET
8. 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.
Ali Asghar Manjotho, Lecturer CSE-MUET
8. Indexed Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0000
Base = 2800h
Effective address of operand = Base + IX
2800h + 0000h = 2800h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0001
2800h + 0001h = 2801h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0002
2800h + 0002h = 2802h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0003
2800h + 0003h = 2803h
Ali Asghar Manjotho, Lecturer CSE-MUET
8. Indexed Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0000
Base = 2802h
Effective address of operand = Base + IX
2802h + 0000h = 2802h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0001
2802h + 0001h = 2803h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0002
2802h + 0002h = 2804h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
IX 0003
2802h + 0003h = 2805h
Ali Asghar Manjotho, Lecturer CSE-MUET
9. Base Register Addressing Mode
• In base register addressing mode, contents of base register is added to address part
of instruction to obtain effective address.
• It is similar to the indexed addressing mode except the register now is called as base
instead of index.
• The base register hold the beginning/base address.
• The address part of instruction holds the offset.
• Offset remains same, the base changes.
• When the offset is added to the base register the resultant number is the memory
location where the operand will be placed.
Ali Asghar Manjotho, Lecturer CSE-MUET
9. Base Register Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
Base 2800
Offset= 0001h
Effective address of operand = Base Register + offset
2800h + 0001h = 2801h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2801h + 0001h = 2802h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2802h + 0001h = 2803h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2803h + 0001h = 2804h
Base 2801 Base 2802 Base 2803
Ali Asghar Manjotho, Lecturer CSE-MUET
9. Base Register Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
Base 2800
Offset= 0003h
Effective address of operand = Base Register + offset
2800h + 0003h = 2803h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2801h + 0003h = 2804h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2802h + 0003h = 2805h
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2803h + 0003h = 2806h
Base 2801 Base 2802 Base 2803
Ali Asghar Manjotho, Lecturer CSE-MUET
10. Autoincrement or Autodecrement Addressing Mode
• It is similar to register indirect addressing mode.
• Here the register is incremented or decremented before or after its
value is used.
Ali Asghar Manjotho, Lecturer CSE-MUET
10. Autoincrement or Autodecrement Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
HL 2802
At start:
1st Time
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2nd Time
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
3rd Time
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
4th Time
HL 2803 HL 2804 HL 2805
HL pair incremented after its value is used
HL 2802
Ali Asghar Manjotho, Lecturer CSE-MUET
10. Autoincrement or Autodecrement Addressing Mode
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
HL 2803
At start:
1st Time
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
2nd Time
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
3rd Time
2807 22
2806 FF
2805 6D
2804 59
2803 08
2802 2E
2801 F3
2800 9F
4th Time
HL 2805 HL 2806 HL 2807
HL pair incremented before its value is used
HL 2804
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
PC = Program Counter
R1 = Register
XR = Index Register
AC = Accumulator
• Memory is having first instruction to load AC
• Mode will specify the addressing mode to get operand.
• Address field of instruction is 500.
Find out the effective address of operand and
operand value by considering different
addressing modes.
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
1. Immediate Addressing Mode
• As instruction contains immediate number 500.
• It is stored as address 201.
Effective Address = 201
Operand = 500
AC 500
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
2. Register Addressing Mode
• Register R1 contains 400.
• As operand is in register so no any memory location.
Effective Address = Nil
Operand = 400
AC 400
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
3. Register Indirect Addressing Mode
• Register R1 contains 400.
• So effective address of operand is 400.
• The data stored at 400 is 700.
Effective Address = 400
Operand = 700
AC 700
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
4. Direct Addressing Mode
• Instruction contains the address 500.
• So effective address of operand is 500.
• The data stored at 500 is 800.
Effective Address = 500
Operand = 800
AC 800
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
5. Indirect Addressing Mode
• Instruction contains the address 500.
• Address at 500 is 800.
• So effective address of operand is 800.
• The data stored at 800 is 300.
Effective Address = 800
Operand = 300
AC 300
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
6. Relative Addressing Mode
• PC = 200.
• Offset = 500.
• Instruction is of 2 bytes.
• So effective address = PC + 2 + offset = 200 + 500 +2 =
702 .
• The data stored at 702 is 325.
Effective Address = 702
Operand = 325
AC 325
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
7. Index Addressing Mode
• XR = 100.
• Base = 500.
• So effective address = Base + XR = 500 + 100 = 600 .
• The data stored at 600 is 900.
Effective Address = 600
Operand = 900
AC 900
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
8. Autoincrement Addressing Mode
• It is same as register indirect addressing mode except
the contents of R1 are incremented after the execution.
• R1 contains 400.
• So effective address of operand is 400.
• The data stored at 400 is 700.
Effective Address = 400
Operand = 700
AC 700
R1 401
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Address Memory
200 Load to AC Mode
201 Address = 500
202 Next Instruction
399 450
400 700
500 800
600 900
702 325
800 300
PC 200
R1 400
XR 100
AC
9. Autodecrement Addressing Mode
• It is same as register indirect addressing mode except
the contents of R1 are decremented before the
execution.
• R1 contains 400.
• R1 is first decremented to 399.
• So effective address of operand is 399.
• The data stored at 399 is 450.
Effective Address = 399
Operand = 450
AC 450
R1 399
Ali Asghar Manjotho, Lecturer CSE-MUET
Example problem
Addressing Mode Effective Address Operand
Immediate Addressing Mode 201 500
Register Addressing Mode Nil 400
Register Indirect Addressing Mode 400 700
Direct Addressing Mode 500 800
Indirect Addressing Mode 800 300
Relative Addressing Mode 702 325
Indexed Addressing Mode 600 900
Autoincrement Addressing Mode 400 700
Autodecrement Addressing Mode 399 450
Ali Asghar Manjotho, Lecturer CSE-MUET

More Related Content

Similar to Addressing mode.pdf

VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015vtunotesbysree
 
Microprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptxMicroprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptxpvg123456
 
instruction set and classificaion
instruction set and classificaioninstruction set and classificaion
instruction set and classificaionRamaPrabha24
 
Micro PLC_Manal for new comer plc learner
Micro PLC_Manal for new comer plc learnerMicro PLC_Manal for new comer plc learner
Micro PLC_Manal for new comer plc learnerssuser6cedd3
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086COMSATS Abbottabad
 
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptUnit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptIronMan665214
 
8087 MICROPROCESSOR and diagram with definition.pdf
8087 MICROPROCESSOR and diagram with definition.pdf8087 MICROPROCESSOR and diagram with definition.pdf
8087 MICROPROCESSOR and diagram with definition.pdfMalligaarjunanN
 
Microprocessors-based systems (under graduate course) Lecture 3 of 9
Microprocessors-based systems (under graduate course) Lecture 3 of 9 Microprocessors-based systems (under graduate course) Lecture 3 of 9
Microprocessors-based systems (under graduate course) Lecture 3 of 9 Randa Elanwar
 
8087 COPROCESSOR connection with 8086 and other processors
8087 COPROCESSOR connection with 8086 and other processors8087 COPROCESSOR connection with 8086 and other processors
8087 COPROCESSOR connection with 8086 and other processorsDrVikasMahor
 
Assembly language.pptx
Assembly language.pptxAssembly language.pptx
Assembly language.pptxShaistaRiaz4
 
180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-dochomeworkping10
 
Introduction to 8085 microprocessor
Introduction to 8085 microprocessorIntroduction to 8085 microprocessor
Introduction to 8085 microprocessorvenkateshkannat
 
Types of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessorTypes of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessorsamarthpawar9890
 

Similar to Addressing mode.pdf (20)

VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
VTU 4TH SEM CSE MICROPROCESSORS SOLVED PAPERS OF JUNE-2014 & JUNE-2015
 
Microprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptxMicroprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptx
 
instruction set and classificaion
instruction set and classificaioninstruction set and classificaion
instruction set and classificaion
 
Arithmetic & Logic Unit
Arithmetic & Logic UnitArithmetic & Logic Unit
Arithmetic & Logic Unit
 
EE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab ManuelEE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab Manuel
 
Micro PLC_Manal for new comer plc learner
Micro PLC_Manal for new comer plc learnerMicro PLC_Manal for new comer plc learner
Micro PLC_Manal for new comer plc learner
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
 
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptUnit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
 
8087 MICROPROCESSOR and diagram with definition.pdf
8087 MICROPROCESSOR and diagram with definition.pdf8087 MICROPROCESSOR and diagram with definition.pdf
8087 MICROPROCESSOR and diagram with definition.pdf
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Microprocessors-based systems (under graduate course) Lecture 3 of 9
Microprocessors-based systems (under graduate course) Lecture 3 of 9 Microprocessors-based systems (under graduate course) Lecture 3 of 9
Microprocessors-based systems (under graduate course) Lecture 3 of 9
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 
MPMC UNIT-2.pdf
MPMC UNIT-2.pdfMPMC UNIT-2.pdf
MPMC UNIT-2.pdf
 
8085 instruction-set part 1
8085 instruction-set part 18085 instruction-set part 1
8085 instruction-set part 1
 
8087 COPROCESSOR connection with 8086 and other processors
8087 COPROCESSOR connection with 8086 and other processors8087 COPROCESSOR connection with 8086 and other processors
8087 COPROCESSOR connection with 8086 and other processors
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Assembly language.pptx
Assembly language.pptxAssembly language.pptx
Assembly language.pptx
 
180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc180410227 ae2406-lab-manual-doc
180410227 ae2406-lab-manual-doc
 
Introduction to 8085 microprocessor
Introduction to 8085 microprocessorIntroduction to 8085 microprocessor
Introduction to 8085 microprocessor
 
Types of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessorTypes of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessor
 

Recently uploaded

Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfsmsksolar
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 

Recently uploaded (20)

Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

Addressing mode.pdf

  • 1. Addressing Modes Miscellaneous Lecture by Ali Asghar Manjotho Lecturer, Department of Computer Systems Engineering, MUET-Jamshoro.
  • 2. 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 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 3. Prerequisite - Registers inside CPU A (8-bit) B (8-bit) C (8-bit) D (8-bit) E (8-bit) H (8-bit) L (8-bit) PC (16-bit) SP (16-bit) S Z A C P C Y General Purpose Registers Index Registers Accumulator Flag Register / Program Status Word (PSW) S = Sign, Z = Zero, CY = Carry, AC = Auxiliary Carry, P = Parity, Ali Asghar Manjotho, Lecturer CSE-MUET
  • 4. 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. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 5. 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. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 6. Addressing Modes 1. Immediate Addressing Mode 2. Register Addressing Mode 3. Register Indirect Addressing Mode 4. Direct Addressing Mode 5. Indirect Addressing Mode 6. Implied Addressing Mode 7. Relative Addressing Mode 8. Indexed Addressing Mode 9. Base Register Addressing Mode 10. Autoincrement or Autodecrement Addressing Mode Ali Asghar Manjotho, Lecturer CSE-MUET
  • 7. 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 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 8. 2. 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 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 9. 3. Register Indirect Addressing Mode • The instruction specifies the register in which the memory address of operand is placed. • It do not specify the operand itself but its location with in the memory where operand is placed. Move MOV A , M A ← [[H][L]] It moves the data from memory location specified by HL register pair to A. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 10. 3. 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 A9 2804 2803 2802 2801 2800 A H 28 L 05 Before 2807 2806 2805 A9 2804 2803 2802 2801 2800 A A9 H 28 L 05 After A ← [2805] A ← A9 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 11. 4. 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. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 12. 4. Direct Addressing Mode LDA 2805h A ← [2805] It loads the data from memory location 2805 to A. 2807 2806 2805 5C 2804 2803 2802 2801 2800 A Before 2807 2806 2805 5C 2804 2803 2802 2801 2800 A 5C After A ← [2805] A ← 5C Ali Asghar Manjotho, Lecturer CSE-MUET
  • 13. 4. 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 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 14. 5. 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. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 15. 5. Indirect Addressing Mode MOV A, 2802h A ← [[2802]] It moves the data from memory location specified by the location 2802 to A. 2807 2806 FF 2805 2804 2803 06 2802 28 2801 2800 A Before 2807 2806 FF 2805 2804 2803 06 2802 28 2801 2800 A FF After A ← [[2802]] A ← FF Ali Asghar Manjotho, Lecturer CSE-MUET
  • 16. 6. 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) Ali Asghar Manjotho, Lecturer CSE-MUET
  • 17. 7. 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. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 18. 7. Relative Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F PC 2801 Offset = 04h Effective address of operand = PC + 01 + offset Effective address of operand = 2801 + 01 + 04 Effective address of operand = 2806h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F Actual Operand Ali Asghar Manjotho, Lecturer CSE-MUET
  • 19. 7. Relative Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 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 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F Actual Operand Ali Asghar Manjotho, Lecturer CSE-MUET
  • 20. 8. 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. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 21. 8. Indexed Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0000 Base = 2800h Effective address of operand = Base + IX 2800h + 0000h = 2800h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0001 2800h + 0001h = 2801h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0002 2800h + 0002h = 2802h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0003 2800h + 0003h = 2803h Ali Asghar Manjotho, Lecturer CSE-MUET
  • 22. 8. Indexed Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0000 Base = 2802h Effective address of operand = Base + IX 2802h + 0000h = 2802h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0001 2802h + 0001h = 2803h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0002 2802h + 0002h = 2804h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F IX 0003 2802h + 0003h = 2805h Ali Asghar Manjotho, Lecturer CSE-MUET
  • 23. 9. Base Register Addressing Mode • In base register addressing mode, contents of base register is added to address part of instruction to obtain effective address. • It is similar to the indexed addressing mode except the register now is called as base instead of index. • The base register hold the beginning/base address. • The address part of instruction holds the offset. • Offset remains same, the base changes. • When the offset is added to the base register the resultant number is the memory location where the operand will be placed. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 24. 9. Base Register Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F Base 2800 Offset= 0001h Effective address of operand = Base Register + offset 2800h + 0001h = 2801h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2801h + 0001h = 2802h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2802h + 0001h = 2803h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2803h + 0001h = 2804h Base 2801 Base 2802 Base 2803 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 25. 9. Base Register Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F Base 2800 Offset= 0003h Effective address of operand = Base Register + offset 2800h + 0003h = 2803h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2801h + 0003h = 2804h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2802h + 0003h = 2805h 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2803h + 0003h = 2806h Base 2801 Base 2802 Base 2803 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 26. 10. Autoincrement or Autodecrement Addressing Mode • It is similar to register indirect addressing mode. • Here the register is incremented or decremented before or after its value is used. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 27. 10. Autoincrement or Autodecrement Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F HL 2802 At start: 1st Time 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2nd Time 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 3rd Time 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 4th Time HL 2803 HL 2804 HL 2805 HL pair incremented after its value is used HL 2802 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 28. 10. Autoincrement or Autodecrement Addressing Mode 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F HL 2803 At start: 1st Time 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 2nd Time 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 3rd Time 2807 22 2806 FF 2805 6D 2804 59 2803 08 2802 2E 2801 F3 2800 9F 4th Time HL 2805 HL 2806 HL 2807 HL pair incremented before its value is used HL 2804 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 29. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC PC = Program Counter R1 = Register XR = Index Register AC = Accumulator • Memory is having first instruction to load AC • Mode will specify the addressing mode to get operand. • Address field of instruction is 500. Find out the effective address of operand and operand value by considering different addressing modes. Ali Asghar Manjotho, Lecturer CSE-MUET
  • 30. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 1. Immediate Addressing Mode • As instruction contains immediate number 500. • It is stored as address 201. Effective Address = 201 Operand = 500 AC 500 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 31. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 2. Register Addressing Mode • Register R1 contains 400. • As operand is in register so no any memory location. Effective Address = Nil Operand = 400 AC 400 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 32. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 3. Register Indirect Addressing Mode • Register R1 contains 400. • So effective address of operand is 400. • The data stored at 400 is 700. Effective Address = 400 Operand = 700 AC 700 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 33. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 4. Direct Addressing Mode • Instruction contains the address 500. • So effective address of operand is 500. • The data stored at 500 is 800. Effective Address = 500 Operand = 800 AC 800 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 34. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 5. Indirect Addressing Mode • Instruction contains the address 500. • Address at 500 is 800. • So effective address of operand is 800. • The data stored at 800 is 300. Effective Address = 800 Operand = 300 AC 300 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 35. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 6. Relative Addressing Mode • PC = 200. • Offset = 500. • Instruction is of 2 bytes. • So effective address = PC + 2 + offset = 200 + 500 +2 = 702 . • The data stored at 702 is 325. Effective Address = 702 Operand = 325 AC 325 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 36. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 7. Index Addressing Mode • XR = 100. • Base = 500. • So effective address = Base + XR = 500 + 100 = 600 . • The data stored at 600 is 900. Effective Address = 600 Operand = 900 AC 900 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 37. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 8. Autoincrement Addressing Mode • It is same as register indirect addressing mode except the contents of R1 are incremented after the execution. • R1 contains 400. • So effective address of operand is 400. • The data stored at 400 is 700. Effective Address = 400 Operand = 700 AC 700 R1 401 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 38. Example problem Address Memory 200 Load to AC Mode 201 Address = 500 202 Next Instruction 399 450 400 700 500 800 600 900 702 325 800 300 PC 200 R1 400 XR 100 AC 9. Autodecrement Addressing Mode • It is same as register indirect addressing mode except the contents of R1 are decremented before the execution. • R1 contains 400. • R1 is first decremented to 399. • So effective address of operand is 399. • The data stored at 399 is 450. Effective Address = 399 Operand = 450 AC 450 R1 399 Ali Asghar Manjotho, Lecturer CSE-MUET
  • 39. Example problem Addressing Mode Effective Address Operand Immediate Addressing Mode 201 500 Register Addressing Mode Nil 400 Register Indirect Addressing Mode 400 700 Direct Addressing Mode 500 800 Indirect Addressing Mode 800 300 Relative Addressing Mode 702 325 Indexed Addressing Mode 600 900 Autoincrement Addressing Mode 400 700 Autodecrement Addressing Mode 399 450 Ali Asghar Manjotho, Lecturer CSE-MUET