The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+2 votes
301 views
Self reallocating code  required for displacement addressing mode.How ?Please someone explain this concept.
asked in CO and Architecture by Loyal (7.4k points)
retagged by | 301 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 .

answered by Veteran (68.9k 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
asked Jan 11, 2018 in CO and Architecture by thepeeyoosh Active (1.9k points) | 590 views
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
49,811 questions
54,540 answers
188,429 comments
75,596 users