Author Topic: How can we distinguish direct addressing from register indirect addressing?  (Read 6858 times)

Offline maplesirop

  • Jr. Member
  • *
  • Posts: 60
This is register indirect addressing:

mov eax, [edx]

and this is direct addressing

mov AL, [label1]

how do we distinguish them?

I thought [var] meant access the address instead of the value...

Do base and base indexed addressing work like register indirect addressing (by accessing the address instead of the value)?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
"[var]" refers to the value at address "var".

Code: [Select]
section .data
    var dd 42
    array dd 10, 20, 30, 40

section .text
    mov eax, [var] ; 42 in eax
    mov eax, var ; 0x8049123 (or so) in eax
    mov eax, array ; address
    mov ebx, 2 ; element to get (counting from 0)
    mov eax, [eax + ebx * 4] ; 30 in eax
Something like that...