title: x86: using memory / swapping values?
body: <p>I'm just getting into x86 for a systems class and have a couple of questions:</p>
  
  <p>1) Say I reference a piece of memory with:</p>
  
  <pre><code>(%eax)
  </code></pre>
  
  <p>The parentheses indicate I'm accessing memory and <code>%eax</code> indicates I want to access <em>that</em> particular address in memory.  So if register <code>%eax</code> stores <code>0x104</code>, <code>(%eax)</code> will return whatever is stored at memory location 0x104.  Is this correct?</p>
  
  <p>2) Say I want to swap the values stored at <code>(%eax)</code> and <code>(%ebx)</code>.  Here's my 
  attempt:</p>
  
  <pre><code>//store values in registers
  movl (%eax) eax
  movl (%ebx) ebx
  
  //store values in opposite registers from where they came originally
  movl ebx (%eax)
  movl eax (%ebx)
  </code></pre>
  
  <p>Does this look right?</p>
  
  <p>Thanks for the help,
  bclayman</p>