An exercise problem stated that :
Which of the following addressing modes permits relocation without any change whatsoever in the code?
- Indirect addressing
- Indexed addressing
- Base register addressing
- PC relative addressing
Somewhere it explained as :
Base register addressing : In this mode , content of base register is added to the address part of the instruction to obtain effective address . A Base register is assumed to hold a base address and the address field of the instruction gives a displacement relative to the base address with a base register , the displacement values of the instruction do not have to change only the value of the base register requires updating to reflect the beginning of a new memory of constant .
Hence , option (3) is true .
I found another explanation too , which stated that base addressing mode and relative addressing mode are suitable for relocation at run time .
My question is :
Which addressing modes permits relocation without any change whatsoever in the code?
Can you explain it in a formal way, please?