The Gateway to Computer Science Excellence
+2 votes
317 views
Self reallocating code  required for displacement addressing mode.How ?Please someone explain this concept.
in CO and Architecture by Loyal (7.7k points)
retagged by | 317 views

1 Answer

0 votes

There is a base register exist for displacement addressing mode.

Base register contains a pointer to a memory location. An integer ( or constant) is also referred to as a displacement. The address of the operand is obtained by adding the contents of the base register plus the constant. 

self-relocating program is a program that relocates its own address-dependent instructions and data when run, and is therefore capable of being loaded into memory at any address.

So self relocating means self modifying .

by Veteran (71.8k points)
0
@Bikram Sir it means it is "modifying the address only ".  Then in this case can I  say self-relocating code also required for indirect addressing mode ?
+1

Self reallocating code  required for displacement addressing mode

It simply means it can calculate it's own effective address by itself , by adding that integer constant to base register address.

In indirect addressing mode we have register or memory location that contains the address of the operand is directly used in instruction .

 But in case of displacement mode  we add a constant value , in case of indirect mode , that integer constant is not added.

so both are not same . and in case of displacement self relocating code can be used only .
 

Related questions

+4 votes
0 answers
1
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,666 questions
56,131 answers
193,671 comments
93,310 users