Edit:  I'm using MASM32.

While reading various texts, I've found myself a little confused.  Looking over "All About Arrays" (from this site's wiki), I see the following:

ElementSize equ 4        ; Define element size
mov  eax,Index           ; Get normalized index
imul eax,ElementSize     ; Scale it
mov  ecx,DwordArray ; Get array value


If my understanding is correct, the address of "Index" - not the contents - is placed into eax.  If that's the case, how can the address be multiplied by another address (ElementSize)?

Perhaps my lack of understanding has to do with addressing modes, but don't the [] designate the value and not the address?
Posted on 2010-07-01 10:14:17 by SyWiles
It is the value itself, not its address, that is loaded. AFAIK only TASM's ideal mode required sqare brackets to strictly differentiate address references from value references.

So, basically, it goes like this:
1. ElementSize := 4
2. eax := Index
3. eax := Index * ElementSize
4. ecx := 4 bytes starting from memory location pointed by .
Posted on 2010-07-01 10:32:51 by ti_mo_n
Thanks for responding.

So if the value is loaded into eax using mov eax, Index, what does mov eax, load into eax?  I would assume the address, if the bracket-less version loads the value, but that's contrary to what I've read so far.
Posted on 2010-07-01 10:44:08 by SyWiles
Both load the contents, it is "mov eax, OFFSET Index" which loads the pointer. Besides TASM, FASM also use "mov eax, Index" for pointer and "mov eax, " for contents and does not understands "offset".
Posted on 2010-07-01 11:51:26 by LocoDelAssembly
I think I have a better understanding.  Thank you.
Posted on 2010-07-01 13:01:08 by SyWiles