Contents Prev Next Up


3.7 Stack Instructions

nop

Do nothing
 
nop = 0

Stack: no change 

Do nothing.

pop

Pop top stack word
 
pop = 87

Stack: ..., any => ...

Pop the top word from the stack.

pop2

Pop top two stack word
 
pop2 = 88
s

Stack: ..., any2, any1 => ...

Pop the top two words from the stack.

dup

Duplicate top stack word
 
dup = 89

Stack: ..., any => ..., any, any

Duplicate the top word on the stack.

dup2

Duplicate top two stack word
 
dup2 = 92
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
 
dup_x1 = 90

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
 
dup2_x1 = 93

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
 
dup_x2 = 91

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
 
dup2_x2 = 94

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
 
swap = 95

Stack: ..., any2, any1 => ..., any2, any1

Swap the top two elements on the stack.


Contents Prev Next Up