NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: maplesirop on April 18, 2013, 09:14:42 PM
-
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)?
-
"[var]" refers to the value at address "var".
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...
Best,
Frank