/** * 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); }
/** * 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); }
/** * 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; }