Search code examples
assemblyx86cpu-registersatt

Assembly Language Operand Specifiers


I am new to learning assembly language and came across the following expressions:

  • 9(%rax, %rdx)
  • 0xFC(,%rcx,4)
  • (%rax, %rdx, 4)

I would be really grateful if someone could point me to a resource where I can understand these commands or explain them to me.

Thank you.


Solution

  • This apparently refers to arithmetic addressing in x86 AT&T assembly.

    The syntax is rather simple:

    N(%reg1, %reg2, F)
    

    This results in address = N + %reg1 + %reg2 * F. This can be used in multiple instructions for purposes like accessing data inside a struct (C compilers), etc.

    For full reference, check this guide.