title: ASM Interpreter: How are local variables stored?
body: <p>for my homework I need to write a very little virtual 16 bit Assembler-Interpreter in C#.
  It simulates the RAM with a byte-array (64k) and the registers with Variables (A,B,C,...).
  Now I need a way to save local variables, google says that they are allocated on the Stack.</p>
  
  <p>But the thing thats unclear to me is, when they are allocated on the Stack (with push...), how is the Interpreter accessing them when they are used later?</p>
  
  <p>See the following 2 lines:</p>
  
  <pre><code>pi INT 3
  mov A, pi
  </code></pre>
  
  <p>In the first line, pi is allocated on the stack, in the second line, pi is used, but how should the Interpreter know where pi is in the stack to access its data? (my Stack is a byte-array too with 2 helper-functions (push, pop), there is also a pointer to the top of the stack)</p>