Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flow Control

OPCODEDESCRIPTION
errFail immediately.
bnz targetbranch to TARGET if value A is not zero
bz targetbranch to TARGET if value A is zero
b targetbranch unconditionally to TARGET
returnuse A as success value; end
popdiscard A
popn nremove N values from the top of the stack
dupduplicate A
dup2duplicate A and B
dupn nduplicate A, N times
dig nNth value from the top of the stack. dig 0 is equivalent to dup
bury nreplace the Nth value from the top of the stack with A. bury 0 fails.
cover nremove top of stack, and place it deeper in the stack such that N elements are above it. Fails if stack depth <= N.
uncover nremove the value at depth N in the stack and shift above items down so the Nth deep value is on top of the stack. Fails if stack depth <= N.
frame_dig iNth (signed) value from the frame pointer.
frame_bury ireplace the Nth (signed) value from the frame pointer in the stack with A
swapswaps A and B on stack
selectselects one of two values based on top-of-stack: B if C != 0, else A
assertimmediately fail unless A is a non-zero number
callsub targetbranch unconditionally to TARGET, saving the next instruction on the call stack
proto a rPrepare top call frame for a retsub that will assume A args and R return values.
retsubpop the top instruction from the call stack and branch to it
switch target ...branch to the Ath label. Continue at following instruction if index A exceeds the number of labels.
match target ...given match cases from A[1] to A[N], branch to the Ith label where A[I] = B. Continue to the following instruction if no matches are found.