home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,259 of 4,675   
   Rod Pemberton to Nathan Dean   
   Re: Memory adress in register, how to ac   
   30 Dec 20 05:19:22   
   
   From: nomailings@nospicedham.trgzxcqvbe.cpm   
      
   On Tue, 29 Dec 2020 10:38:20 -0800 (PST)   
   Nathan Dean  wrote:   
      
   > I'm pretty new to assembly and I'm writing my homework. I can't find   
   > a solution to my problem, so I thought I'd ask here:   
   >   
   > I have a memory adress in one of my registers (ecx in this case), and   
   > that memory adress points to an array. I would like to acces that   
   > array by using something like this: MOV [ecx + 4*8], eax but in this   
   > case, the program takes the memory adress of the ecx, and adds to   
   > that. How could I solve this? (Also if you could reference something   
   > to read about this, that would be helpful also)   
   >   
      
   x86 has a special instruction that simplifies computing addressing of   
   array elements.  It's called LEA.  It's "just like" using MOV, but LEA   
   works with the address, instead of retrieving the value.  See here for   
   an example of the two:   
      
   https://stackoverflow.com/questions/1658294/whats-the-purpose-of   
   the-lea-instruction   
      
   BTW, we don't do homework.  To truly learn something, you have to do it   
   yourself.  You have to put in the time.  There is no other way.   
      
   --   
   Sigh ...   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca