title: Difference between three ways of referencing a variable
body: <p>I've noticed that all of the following three ways 'work' to access a variable in asm:</p>
  <ol>
  <li><p>name it literally:</p>
  <pre><code>.globl main
  number1:  .byte 7
  number2:  .byte 14
  main:
      mov number1,     %ebx
      mov number2,     %ecx
      mov $0,     %eax
  multiply_step:
      add %ebx,   %eax
      dec %ecx
      jnz multiply_step
      ret
  </code></pre>
  </li>
  <li><p>name it with a <code>$</code> prepended:</p>
  <pre><code>number1:  .byte 7         # use number1 = 7 or .equ to make this block work
  number2:  .byte 14
  main:
      mov $number1,     %ebx   # editor's note: this gets the address
      mov $number2,     %ecx   # not the value.
  </code></pre>
  </li>
  <li><p>name it relative to <code>rip</code>:</p>
  <pre><code>number1:  .byte 7
  number2:  .byte 14
  main:
      mov number1(%rip),     %ebx
      mov number2(%rip),     %ecx
  </code></pre>
  </li>
  </ol>
  <p>All three give me the same product, <code>98</code>, when you multiply them like in <a href="https://stackoverflow.com/questions/63333752/delay-when-running-asm-program-with-named-variables">this question</a>.</p>
  <p>What's the difference between these three ways to reference a variable, and is one of the ways preferred over the others?</p>