Hinting tutorial/Stack manipulation

From DejaVu

Jump to: navigation, search

Hinting tutorial index | Previous: The stack | Next: Example: Hinting L

Here are some functions you can use to manipulate the stack. You won't need these functions often (some of them are barely used), but you should know that they are available.

If you are new to hinting, you can skip this part for now.


Contents

Syntax

CLEAR

(CLEAR the stack)

  • Pops all items from the stack
  • The stack will be empty after this


DUP

(DUPlicate the top stack element)

  • Pushes the stack top element again

example:

PUSHB_2
 1
 2
DUP

After this, the stack will have three items: 1, 2 and 2.


SWAP

(SWAP the top two elements on the stack)

  • The top element becomes second element from the top
  • The second element from the top becomes the top

example:

PUSHB_2
 1
 2
SWAP

After this, the stack will have 1 on top.

Personal tools