OpenBoot 2.x Quick Reference

Stack Manipulation Commands

Table 1-21 Stack Maniulation Commands

-rot

( n1 n2 n3 -- n3 n1 n2 ) 

Inversely rotate three stack items. 

>r

( n -- ) 

Move a stack item to the return stack. (Use with caution.) 

?dup

( n -- n n | 0 ) 

Duplicate the top stack item if non-zero. 

2drop

( n1 n2 -- ) 

Remove two items from the stack. 

2dup

( n1 n2 -- n1 n2 n1 n2 ) 

Duplicate two stack items. 

2over

( n1 n2 n3 n4 -- n1 n2 n3 n4 n1 n2 ) 

Copy second two stack items. 

2swap

( n1 n2 n3 n4 -- n3 n4 n1 n2 ) 

Exchange two pairs of stack items. 

clear

( ??? -- ) 

Empty the stack. 

depth

( ??? -- ??? +n ) 

Return the number of items on the stack. 

drop

( n -- ) 

Remove the top item from the stack. 

dup

( n -- n n )  

Duplicate the top stack item. 

nip

( n1 n2 -- n2 ) 

Discard the second stack item. 

over

( n1 n2 -- n1 n2 n1 ) 

Copy the second stack item to the top of the stack. 

pick

( ??? +n -- ??? n2 ) 

Copy +n-th stack item (1 pick = over).

r>

( -- n ) 

Move a return stack item to the stack. (Use with caution.)  

r@

( -- n ) 

Copy the top of the return stack to the stack.  

roll

( ??? +n -- ? ) 

Rotate +n stack items (2 roll = rot).

rot

( n1 n2 n3 -- n2 n3 n1 ) 

Rotate three stack items. 

swap

( n1 n2 -- n2 n1 ) 

Exchange the top two stack items. 

tuck

( n1 n2 -- n2 n1 n2 ) 

Copy the top stack item below the second item.