Alex Rivera | Logout

What do the brackets mean in NASM syntax for x86 asm?

Asked 2010-01-08T20:04:15.470
76

Given the following code:

L1     db    "word", 0

       mov   al, [L1]
       mov   eax, L1

What do the brackets in [L1] represent?


This question is specifically about NASM. The other major flavour of Intel-syntax assembly is MASM style, where brackets work differently when there's no register involved:
See Confusing brackets in MASM32

Edit
Report

1 Answer

12

The brackets mean to de-reference an address. For example

mov eax, [1234]

means, mov the contents of address 1234 to EAX. So:

1234 00001

EAX will contain 00001.

answered 2010-01-08T20:06:55.747

Your Answer