You are on page 1of 15

TOPIC : ADDRESSING MODES

PRESENTED TO : MISS ISMAT TARIQ


PRESENTED BY : MUHAMMAD HAMID
ROLL NO : F17MB013
COURSE : ADVANCED COMPUTER ARCHITECTURE
ADDRESSING MODES

• The job of a microprocessor is to execute a set of instructions stored


in memory to perform a specific task. Operations require 1) the
operator or opcode which determines what will be done, and 2) the
operands which define the data to be used in the operation. For
example, if we wanted to add the numbers 1 and 2 and get a result,
mathematically we would likely write this as 1 + 2. In this case our
operator is (+) or the addition and our operands are the numbers 1
and 2.
• In a microprocessor, the machine needs to be told how to get the
operands to perform the operation. The effective address is a term
that describes the address of an operand that is stored in memory.
There are several methods to designate the effective address of
those operands or get them directly from the register. These
methods are known as addressing modes.
TYPES OF ADDRESSING MODES

• Immediate Addressing Mode


• Direct Addressing Mode
• Indirect Addressing Mode
• Relative Addressing Mode
• Index Addressing Mode
• Register Addressing Mode
• Register Indirect Addressing Mode
• Auto-Increment
• Auto-Decrement
IMMEDIATE ADDRESSING MODE

• Data is in the address part , from where we get the effective address.
• One instruction has two memory locations.
• Effective Address=031
• Data=500

030 Mode Op Code

031 500
DIRECT ADDRESSING MODE

• When using direct addressing mode, the address of the operand is


specified the instruction. The processor will retrieve the data directly
from the address specified in the instruction.
• Effective Address=500
• Data=800

030 Mode Op Code

031 500

032 Next Instruction

500 800
INDIRECT ADDRESSING MODE

• In this we find the address from which we find the address of data.
• Effective Address=800
• Data=1200

030 Mode Op Code

031 500

032 Next Instruction

500 800

800 1200
RELATIVE ADDRESSING MODE

• In this mode PC value is added to the address field to obtain the


effective address.
• Effective Address = Pc value + Base instruction address
• Effective Address = 032 + 500 = 532
• Data=123
030 Mode Op Code

031 500

032 Next Instruction

500 800

800 1200

532 123
INDEX ADDRESSING MODE

• The content of the Index Register are added to the address part of
the instruction to get and effective address.
• Index Register = 100 030 Mode Op Code

• Address Part = 500 031 500

• Effective Address = 600 032 Next Instruction

• Data = 1234
500 800

800 1200

532 123

600 1234
REGISTER INDIRECT ADDRESSING MODE

• Register R1 value is used as an effective address and data is taken


from that address.
• R1=400 030 Mode Op Code

• Effective Address=400 031 500

• Data=12345 032 Next Instruction

400 12345

500 800

800 1200

532 123

600 1234
REGISTER ADDRESSING MODE

• There is no effective address and value of the Register is loaded in


AC. 030 Mode Op Code
• R1=400 031 500
• Data = 400 032 Next Instruction

400 12345

500 800

800 1200

532 123

600 1234

400
AUTO-DECREMENT

• In Auto-Decrement Register value is decremented and used as an


effective address and data is taken from that address.
• R1 = 400 030 Mode Op Code

• R1-- = 399 031 500

032 Next Instruction


• EA = 399
• Data = 1500
400 12345

500 800

600 1234

400

399 1500
AUTO-INCREMENT

• Auto-Increment is same as Register Indirect Addressing Mode. In this


Register value is incremented and used as an effective address and
data is taken from that address.
• R1 = 400 030 Mode Op Code
031 500
• EA = 400
032 Next Instruction
• Data = 12345
400 12345

500 800

532 123

600 1234

399 1500
NUMERICAL EXAMPLE

• To show the differences between the various modes, we will show


the effect of the addressing modes on the instruction defined in fig:1.
The two-word instruction at address 200 and 201 is a “load to AC”
instruction with an address field equal to 500. The first word of the
instruction specifies the operation code and mode, and the second
word specifies the address part. PC has the value 200 for fetching this
instruction. The content of the processor register R1 is 400,and the
content of an index register XR is 100. AC receives the operand after
the instruction is executed.
Address Memory
PC=200 200 Load TO AC Mode

R1=400 201 Address=500

202 Next Instruction


XR=100

399 450
AC
400 700

500 800

600 900

702 325

800 300
NUMERICAL SOLUTION

Address Mode Effective Address Content Of AC

Direct Address 500 800

Immediate Address 201 500

Indirect Address 800 300

Relative Address 702 325

Indexed Address 600 900

Register 400

Register Indirect 400 700

Auto--decrement 399 450

Auto--increment 400 700

You might also like