Contents Prev Next Up
3.7 Stack Instructions
nop
Do nothing
Stack: no change
Do nothing.
pop
Pop top stack word
Stack: ..., any => ...
Pop the top word from the stack.
pop2
Pop top two stack word
s
Stack: ..., any2, any1 => ...
Pop the top two words from the stack.
dup
Duplicate top stack word
Stack: ..., any => ..., any, any
Duplicate the top word on the stack.
dup2
Duplicate top two stack word
s
Stack: ..., any2, any1 => ..., any2, any1, any2, any1
Duplicate the top two words on the stack.
dup_x1
Duplicate top stack word and put two down
Stack: ..., any2, any1 => ..., any1, any2, any1
Duplicate the top word on the stack and insert the copy two words down in the stack.
dup2_x1
Duplicate top two stack words and put two down
Stack: ..., any3, any2, any1 => ..., any2, any1, any3, any2, any1
Duplicate the top two words on the stack and insert the copies two words down in the stack.
dup_x2
Duplicate top stack word and put three down
Stack: ..., any3, any2, any1 => ..., any1, any3, any2, any1
Duplicate the top word on the stack and insert the copy three words down in the stack.
dup2_x2
Duplicate top two stack words and put three down
Stack: ..., any4, any3, any2, any1 => ..., any2, any1, any4, any3, any2, any1
Duplicate the top two words on the stack and insert the copies three words down in the stack.
swap
Swap top two stack words
Stack: ..., any2, any1 => ..., any2, any1
Swap the top two elements on the stack.
Contents Prev Next Up