Search code examples
assemblyx86nasmcpu-registersmov

meanings of mov instruction with or without [] brackets around the source register in nasm


I'm a little bit rusty on Assembly. I want to ask you guys some questions.

  1. Are these assembly instructions valid in NASM?
  2. What are the differences, and when should we use them?
    mov EAX, EBX

vs

    mov EAX, [EBX]

Solution

  • mov EAX, EBX
    

    moves the value of EBX into EAX, while

    mov EAX, [EBX]
    

    moves the value of the address in EBX (so EBX must contain a valid address, otherwise you will get a segmentation fault) into EAX.