Prerequisite – Addressing Modes
In an Instruction Fetch operation of the Instruction Cycle Process, addressing mode plays a crucial part. Addressing Mode is the way in which the operand is addressed in an instruction word before being actually executed.
1. Relative Address Mode :
In this mode, the Effective Address (EA) of the operand is calculated by adding the content of the CPU register and the address part of the instruction word. The effective address is calculated by adding displacement (immediate value given in the instruction) and the register value. The address part of the instruction is usually a signed number, either positive or negative. The effective address thus calculated is relative to the address of the next instruction.
EA = CPU Register + Displacement
Relative Addressing Mode can be further classified into three types –
- PC (Program Counter) Relative Addressing Mode.
- Index Register Relative Addressing Mode or Indexed Addressing Mode.
- Base Register Addressing Mode.
2. Direct Address Mode :
In Direct Address Mode, the effective address of the operand is equal to the address part of the instruction, i.e. the address part of the instruction indicates the memory location containing the operand.
ADD R1, 4000 where 4000 is the effective address of the location.
In this example, the memory location 4000 contains the operand 100 which gets added to the contents of R1 and gets stored in R1.
Difference between Relative Addressing Mode and Direct Addressing Mode :
|S.NO.||RELATIVE ADDRESSING MODE||DIRECT ADDRESSING MODE|
|1.||Effective address is calculated by adding the contents of the CPU Register with the address part of the instruction.||The address for fetching the operand is already provided in the address part of the instruction. It is not calculated.|
|2.||Relative mode has three types : PC Relative, Index Register Relative, Base Register Relative Addressing modes.||Direct addressing mode has no types.|
|3.||It results in shorter address field in the instruction format as the relative address can be specified with a small number of bits.||It results in longer address field in the instruction format as it requires more number of bits to designate the entire memory address.|
|4.||It is often used with branch type instructions since it directly updates the program counter.||It is not used in branch type of instructions.|
|5.||It is used for writing relocatable code, position independent code, i.e. for program relocation at run time.||It is used to access static data.|
|6.||It is used to implement array addressing, records.||It is used to implement variables.|
|7.||It is used to handle recursive procedures.||It cannot handle recursive procedures.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Implied addressing mode and Immediate addressing mode
- 8085 program to swap two 16 bit numbers using Direct addressing mode
- 8085 program to swap two 8 bit numbers using Direct addressing mode
- Difference between Direct and Indirect Addressing Modes
- Difference between Direct and Immediate Addressing Modes
- Difference between Direct and Implied Addressing Modes
- Difference between PC relative and Base register Addressing Modes
- Difference between Register Mode and Register Indirect Mode
- User mode and Kernel mode Switching
- Difference between Direct and Arbitrated Digital Signature
- Difference between Relative and Absolute Deadline of Real-time Task
- Difference between Relative and Absolute symlinks
- Difference between Indirect and Implied Addressing Modes
- Difference between Memory based and Register based Addressing Modes
- Difference between Indirect and Immediate Addressing Modes
- Removing Direct and Indirect Left Recursion in a Grammar
- Direct memory access with DMA controller 8257/8237
- IPv6 Addressing Format and Conventions
- Addressing Modes
- Addressing modes in 8085 microprocessor
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.