pgubook-readers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pgubook-readers] indexed addressing mode page 15 (revisited)


From: michael osullivan
Subject: Re: [Pgubook-readers] indexed addressing mode page 15 (revisited)
Date: Thu, 6 Oct 2011 13:41:06 +0100 (BST)



--- On Thu, 6/10/11, michael osullivan <address@hidden> wrote:

From: michael osullivan <address@hidden>
Subject: Re: [Pgubook-readers] indexed addressing mode page 15 (revisited)
To: "Justis Durkee" <address@hidden>
Date: Thursday, 6 October, 2011, 13:33

Hi,
Yes both replies make complete sense, it was just that Jonatham stated, with the first example of the multiplier, that we load 3 in the index, and not to forget that we start counting at 0 (zero) . So that means we count the place we are alreadt at and move 3 places forward.

2002 (zero) ,2003 (1), 2004 (2), 2005 (3)  ? this all makes sense

The next example: "...     the fourth word from location 2002 " 
 which gets us to location 2014 - is still not clear to me. 

Yes it all makes sense, setting the index to 3 if we want to move 3 words forwards, but he states we want to move to the "fourth word "  from location 2002. 

It works out we do indeed get to the first byte of the fourth word by setting the index to 3.
And this works for larger numbers; so am i right in thinking that if we want to move a certain number of words at a time, say 7, we set the index to one less than the number of jumps we want to make, so this would be 6, ( the multiplier obviuosly set to 4) to arrive at the 1st byte of the word we want? 

That is why he reminds us to count from zero to 3 on the first examples ?
 
Anyway it does indeed work, do i understand how correctly?

Mike


--- On Thu, 6/10/11, Justis Durkee <address@hidden> wrote:

From: Justis Durkee <address@hidden>
Subject: Re: [Pgubook-readers] indexed addressing mode page 15 (revisited)
To: "Kenny Hegeland" <address@hidden>
Cc: "michael osullivan" <address@hidden>, "address@hidden" <address@hidden>
Date: Thursday, 6 October, 2011, 5:33

>How can this be if we are going  forward 4 bytes ( 0,1,2,3 ?) at a time we would arrive at >location 2017 ( the last byte of the 4th word) ??

You are referencing the multiplier value 4 in two places. word size (4 bytes) and 4th word, when it is really the 3rd word, since the index is 3.

The multiplier designates how big our movements are, and the index designates how many movements to make.

When index = 3 and multiplier equals 4, we move 4 bytes 3 times for a total of 12. 

On Wed, Oct 5, 2011 at 8:09 PM, Kenny Hegeland <address@hidden> wrote:
I'm wondering how you worked out 2017. As far as I know it's similar to the addition addressing. If we were just counting numbers it would look like this:

2002 + (3 * 4) =
2002 + 12 =
2014


On Oct 5, 2011, at 10:07 PM, michael osullivan <address@hidden> wrote:

This was discussed back in 2010-03

http://lists.nongnu.org/archive/html/pgubook-readers/2010-03/index.html

but as i didn't understand it fully from reading those posts, and it was over a year ago here is my own question:
--------------------------------------------------------------------------------------------------------------------------
Hi,
i have a question after reading the beginning of the book. On page 15 we read that :
"In the indexed addressing mode, the instruction contains a memory address to
access, and also specifies an index register to offset that address."

Now this is all easy to follow:  a memory  address offset by the number contained in an index register.  So with the starting address being 2002, with an offset of 3 we arrive at the memory location 2005.

Then we have the next concept: the multiplier for the index, allowing us to access memory one byte at a time , as above, or a word/4 bytes at a time with a value of 4.

So starting at 2002 and loading index register with 3 ( zero would mean the location we specified in the first place ? ) ,  specifying a multiplier of 1 (one byte at a time ) cycling through the the next 3 bytes we come to 2005.

Now the next example we start at 2002 again but want to cycle 4 words forward so we have

2002  index 3  + multiplier 4 (one word)  arriving at memory location 2014

How can this be if we are going  forward 4 bytes ( 0,1,2,3 ?) at a time we would arrive at location 2017 ( the last byte of the 4th word) ??


Any help greatly apreciated

Mike
_______________________________________________
Pgubook-readers mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/pgubook-readers

_______________________________________________
Pgubook-readers mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/pgubook-readers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]