in CO and Architecture retagged by
1,427 views
2 votes
2 votes
Self reallocating code  required for displacement addressing mode.How ?Please someone explain this concept.
in CO and Architecture retagged by
by
1.4k views

1 Answer

2 votes
2 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 .

2 Comments

@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 ?
0
0

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 .
 

2
2

Related questions