Exemplo n.º 1
0
  /**
   * Assembly funcion SWAP. <br>
   * Swaps the top of the main stack.
   *
   * @param rvm Virtual Machine
   * @throws StackUnderflowException
   * @see Stackable
   */
  static void SWAP(RVM rvm) throws StackUnderflowException {
    Stackable top = rvm.DATA.pop();
    Stackable sl = rvm.DATA.pop();

    rvm.DATA.push(top);
    rvm.DATA.push(sl);
    Debug.printStack(rvm);
  }
Exemplo n.º 2
0
 /**
  * Assembly funcion POP. <br>
  * Takes out an element of the top of the main stack.
  *
  * @param rvm Virtual Machine
  * @throws StackUnderflowException
  * @see Stackable
  */
 static Stackable POP(RVM rvm) throws StackUnderflowException {
   Stackable pop = rvm.DATA.pop();
   Debug.printStack(rvm);
   return pop;
 }
Exemplo n.º 3
0
 /**
  * Assembly funcion DUP. <br>
  * Duplicates the top of the main stack.
  *
  * @param rvm Virtual Machine
  * @throws StackUnderflowException
  * @see Stackable
  */
 static void DUP(RVM rvm) throws StackUnderflowException {
   Stackable st = rvm.DATA.pop();
   rvm.DATA.push(st);
   rvm.DATA.push(st);
   Debug.printStack(rvm);
 }
Exemplo n.º 4
0
 /**
  * Assembly funcion PUSH. <br>
  * Puts an element in the top of the main stack.
  *
  * @param rvm Virtual Machine
  * @param st Stackable element.
  * @throws StackUnderflowException
  * @see Stackable
  */
 static void PUSH(RVM rvm, Stackable st) {
   rvm.DATA.push(st);
   Debug.printStack(rvm);
 }