title: What are the ESP and the EBP registers?
body: <p>I found that the ESP register is the current stack pointer and EBP is the base pointer for the current stack frame. However, I don't understand these definitions (I am just starting to learn how to code in assembler). </p>
  
  <p>What I understand is that ESP points towards the stack itself and EBP points towards whatever is on top of the stack<sup>1</sup>.  But these are just my guesses and they are most likely incorrect. Otherwise, what would a statement like the following mean?</p>
  
  <pre><code>MOV EBP, ESP    
  </code></pre>
  
  <p>Footnote 1:   Editor's note: Yes, that's incorrect.  In standard terminology, the "top of the stack" is where ESP points, even though it's the lowest address in the stack frame.  By analogy to a stack data structure that grows upward, even though the callstack on x86 (like most ISAs) grows downward.</p>