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: Herbert R Coburn
Subject: Re: [Pgubook-readers] Re: index register multiplier q
Date: Sun, 07 Mar 2010 08:13:11 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Lightning/1.0b1 Thunderbird/3.0.3

On 03/07/2010 07:23 AM, Brian Haag wrote:
    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.

Yeah, I had it backwards. <hangs head in shame>. /herbc





reply via email to

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