pgubook-readers
[Top][All Lists]
Advanced

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

Re: [Pgubook-readers] Re: index register multiplier q


From: Brian Haag
Subject: Re: [Pgubook-readers] Re: index register multiplier q
Date: Sun, 7 Mar 2010 09:23:19 -0600

It is better to see indexed addressing in terms of accessing arrays.
Say you have an array of 20 integers in memory.
(One integer = 4 bytes)
Now you can acces these in a loop, by using an index and the fixed multiplier of 4 (4 bytes is the size of one element of the array).

so 1st element: index = 0 in %edi, address with "start_array (,%edi,4)"
next element: increment %edi and use same statement ("start_array(,%edi,4)")
etc.

When you have an array of characters (1 byte) then your multiplier is 1.

This makes perfect sense to me, and is what I expected in the first place.  Now that I read it again, the book does seem consistent with it---it's just described in a way I couldn't follow.  Specifically, what I wasn't putting together well is that the multiplier specifies the length of an element (whether a record an array element), and the index register specifies "how many elements" from the address.

Anyway, got it now.  Thanks to both of you.

reply via email to

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