NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: Siko7 on January 19, 2019, 01:18:04 PM

Title: Variable
Post by: Siko7 on January 19, 2019, 01:18:04 PM
Can someone explain, why the value of the register R9 = 0x200000000000000 and not 0x1 is?

Tanks a lot.

Code: [Select]
SECTION .data
var1: dq 0 ; Variable 1 is initialized to 0
SECTION .text
_start:
mov R9, [var1+1]
Title: Re: Variable
Post by: debs3759 on January 19, 2019, 07:14:16 PM
It looks like you are trying to add 1 to var1 then load the result in r9.

What you are actually doing is load r9 with the value stored at the memory location starting at the second byte of var1.