1,030 views
1 votes
1 votes

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

1 Answer

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

Related questions

857
views
1 answers
1 votes
Gurdeep Saini asked Jan 4, 2019
857 views
I know about indirect addressing mode , Index addressing modebut do not know about Indirect index addressing mode ?in one solution of a question they ... address i did not found it on google etcexplain Indirect index addressing mode
2.6k
views
3 answers
3 votes
Himanshu1 asked Dec 4, 2015
2,568 views
396
views
2 answers
0 votes
lea asked Jun 12, 2023
396 views
676
views
0 answers
0 votes
Chaitanya Kale asked Feb 13, 2023
676 views
Consider 3-word long jump instruction designed with PC-relative addressing mode, stored in the memory with a starting address of (2000)$_{10}$. Address field of an ... we assign it to PC?PC should be 2003 at the end of execution right?