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