The Gateway to Computer Science Excellence
0 votes
122 views

If someone mentioned "index value" in indexed addressing mode then which value is it referring; the value of index register or the constant value?


It should be value of index register, isn't it?


But from the given snippet it seems that they are referring constant value

Please clarify

Thank You

in CO and Architecture by (57 points) | 122 views

1 Answer

0 votes
index value is the offset provided to the base address . the basic kind of indexed addressing as explained in Carl hamacher book is the X(Ri) which is used in the code snippet.

X is a fixed offset that is R0 + 4 bytes , this offset cant be changed

Whereas the R0 is base address which can be changed either at beginning of program or as in the loop shown in the snippet by adding #16 to Ro .

The other mode you are talking about is the register offset variation which provides (Ri , Rj)  option to even change the offset . so we dont need 3 instructions for addition we can create one ADD instruction like

 L1 : MOV #4,R4 ; set offset of R4

ADD R4,R0;

then increase the offset counter R4  

ADD #4,R4

Now Branch to L1 with a counter to set the no of times to add 4 to the original offset

This type of code is like working with 2d matrix with (Ri , Rj) being equivalent to rows and columns.
by (29 points)

Related questions

+3 votes
3 answers
2
asked Dec 4, 2015 in CO and Architecture by Himanshu1 Boss (15.6k points) | 837 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
50,666 questions
56,131 answers
193,671 comments
93,309 users