What do the brackets mean in x86 asm?

前端 未结 8 1883
旧时难觅i
旧时难觅i 2020-11-30 20:51

Given the following code:

L1     db    \"word\", 0

       mov   al, [L1]
       mov   eax, L1

What do the brackets ([L1]) represent?

8条回答
  •  無奈伤痛
    2020-11-30 21:18

    As with many assembler languages, this means indirection. In other words, the first mov loads al with the contents of L1 (the byte 'w' in other words), not the address.

    Your second mov actually loads eax with the address L1 and you can later dereference that to get or set its content.

    In both those cases, L1 is conceptually considered to be the address.

提交回复
热议问题