3

I'm trying to understand how exactly memory indirect addressing works in assembly language with AT&T syntax.

movl (%eax), %ebx

movl %eax, (%ebx)

Here is a similar question that explains about memory indirect addressing

This is what I've understood:

In the first case, you load the data pointed to by the register %eax and store it in %ebx.

In the second case, you store the data in the register %eax to the address space pointed to by the register %ebx. Am I correct?

Community
  • 1
  • 1
pistal
  • 2,310
  • 13
  • 41
  • 65

1 Answers1

4

Basically the syntax is

movl source, destination

So movl (%eax), %ebx is indeed copy the value at address pointed to by %eax into %ebx. And movl %eax, (%ebx) is copy the value inside register %eax into the address pointed to by %ebx.

So indeed your understanding is correct.

dda
  • 6,030
  • 2
  • 25
  • 34