How to load the contents of the memory address stored in a register in assembly?

3.7k Views Asked by At

I'm new to assembly and am trying to iterate over a string stored in memory. I'm able to get the address of the string using lea (load effective address) instruction but I want to now use that address stored in a register.

Is there an analog to lw which could be used as follows:

lea string, %edx     ; Load effective address of string into edx
lw %edx, %eax        ; Load eax with the value stored where edx points 

...
string:
    .string "Hello"
1

There are 1 best solutions below

2
On

"mov" is what you're looking for, with indirect addressing (which has some register restrictions based on whichever mode you're in)