I've seen the following definition for how an indexed address is generally used in assembly (from the book Programming from the Group Up):
movl BEGINNINGADDRESS(,%INDEXREGISTER,WORDSIZE)
I've used something like this on arrays (my most recent question) to do something like:
movl my_array(,%rdi,4), %r10 # move the int at the start of my_array into %r10
What is the first element before the first comma, or is this usually left blank? Is the "Beginning Address" always a variable name, or is it ever often something else? Instead of %INDEXREGISTER
, is an absolute memory address or immediate value ever used?
Additionally, here is a good answer related to this: Referencing the contents of a memory location. (x86 addressing modes). I suppose my main question is on the purpose of the base
item (which is left blank in the explanation/example above).