Which of the following addressing modes permits relocation without any...
PC relative addressing mode:
The effective memory address is obtained by computing an offset from the current PC. No matter where the code is loaded in memory, the offsets are always the same so the code needs no modification. In this addressing, there is absolutely no change in code needed.
Therefore the answer is Option 4 i.e, PC relative Addressing
View all questions of this test
Which of the following addressing modes permits relocation without any...
PC relative addressing permits relocation without any change whatsoever in the code.
Explanation:
- PC relative addressing is a type of addressing mode used in computer architecture and assembly language programming.
- In PC relative addressing, the operand of an instruction is the address of the desired data or instruction relative to the current value of the program counter (PC).
- The program counter is a register that stores the address of the next instruction to be executed.
- In PC relative addressing, the address calculation is performed by adding the operand value to the current value of the PC.
- This allows for the relocation of the code without any change in the code itself.
- When the code is relocated to a different memory location, the value of the PC will change accordingly.
- However, since the operand is relative to the PC, the instruction will still access the correct data or instruction, regardless of the relocation.
- This is because the relative offset remains the same, regardless of the absolute address of the instruction.
- PC relative addressing is particularly useful in situations where code needs to be loaded into different memory locations, such as in a dynamic linking or loading scenario.
- It allows for easy relocation of the code without the need to modify the instructions themselves.
- Other addressing modes, such as indirect addressing, indexed addressing, and base register addressing, may require modifications to the code when the code is relocated to a different memory location.
- Therefore, PC relative addressing is the addressing mode that permits relocation without any change whatsoever in the code.