title: trouble understanding assembly command "load effective address"
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1658294/whats-the-purpose-of-the-lea-instruction">What’s the purpose of the LEA instruction?</a><br>
    <a href="https://stackoverflow.com/questions/4534617/lea-instruction">LEA instruction?</a>  </p>
  </blockquote>
  
  
  
  <p>So I'm working on the binary bomb assignment for class (it has a bunch of phases where you have to step through the assembly code of a program and find a passphrase to decode the "bomb").</p>
  
  <p>I can't complete my current phase because I don't understand the lea command. I've read that it's commonly used for arithmetic, but I just don't understand how it does it. </p>
  
  <p>The command I'm looking at in particular is</p>
  
  <pre><code>lea -0x18(%ebp), %ebx
  lea -0x8(%ebp), %esi
  </code></pre>
  
  <p>followed by a</p>
  
  <pre><code>mov -0x4 (%ebx), %eax
  add -0x8(%ebx), %eax
  </code></pre>
  
  <p>in the next line eax and ebx are compared, if they're equal the program continues, else the bomb explodes. </p>
  
  <p>I've figured enough out about this phase to know it wants 6 numbers, the first two being 0 and 1. After that it does some manipulations to determine if the rest of the sequence is correct (I'm assuming the lea commands are what i need to decode to find the next numbers).  </p>
  
  <p>Now what I couldn't find is what the -0x18 in particular refers to. what's the negative sign do? does it indicate subtraction? is it looking 18 bytes before ebp?</p>
  
  <p>Thanks for any help here. </p>