title: dword ptr usage confusion
body: <p>In assembly language if we use</p>
  
  <pre><code>mov eax, dword ptr[ebx]
  </code></pre>
  
  <p>then it means copy the value pointed by ebx (ebx contains the address value, not the actual value, this instruction copies the actual value in the address)?</p>
  
  <p>If we use</p>
  
  <pre><code>mov eax, dword ptr[some_variable]
  </code></pre>
  
  <p>then it means copy the value of variable "some_variable" itself to eax, not copy the value pointed by variable "some_variable"?</p>
  
  <p>Is my understanding correct?</p>
  
  <p>If yes, I'm confused why the same assembly instruction has two different meansings - in the first case there is a level of indirection, but in the second there is no additional level of indirection.</p>
  
  <p>Any comment?</p>
  
  <p>EDIT:</p>
  
  <p>Not every [] does not taking any effect, for example, instruction xchg will take a level of in-direction, which loads value pointed by edx.</p>
  
  <p>Whole source code could be found from,</p>
  
  <p><a href="http://www.codeproject.com/KB/threads/spinlocks.aspx" rel="noreferrer">http://www.codeproject.com/KB/threads/spinlocks.aspx</a></p>
  
  <pre><code>#ifdef WIN32
  inline int CPP_SpinLock::TestAndSet(int* targetAddress, int nValue)
  {
      __asm {
          mov edx, dword ptr [pTargetAddress]
          mov eax, nValue
          lock xchg eax, dword ptr [edx]
      }
  }
  #endif // WIN32
  </code></pre>