GNU AS confusion between memory and immediate depending on declaration order?

45 Views Asked by At

I've searched the web but haven't found anything that answers my question so hopefully someone on here will be able to answer it.

Using GNU AS with Intel syntax (.intel_syntax noprefix) gives mixed results. Using:

mov ax, variable

variable = 5

Compiles as mov ax, [5], whereas

variable = 5

mov ax, variable

Compiles as mov ax, 5.

Does anyone know why defining the variable after its referenced makes it a memory offset rather than a constant value?

0

There are 0 best solutions below