The POP Instruction

Name:

POP X,YZ

Specification:

If X > rL, then first replace X by rL + 1.

The register stack S[0],…,S[τ - 1] is changed as follows:

x ← S[τ - 1]mod256 (size of the callee's stack frame),
S[τ - 1] ← $(X - 1) (main return value),
rL ← min(x + X,rG),
$(rL - 1) ← $(rL - x - 2)
$(x + 1) ← $0,
$x ← S[τ - 1]
$0 ← S[τ - x - 1],
τ ← τ - x - 1
@ ← rJ + 4YZ

Timing:

Description:

The POP instruction undoes the effect of a previous PUSHJ Instruction. X indicates the number of return values in registers $0 to $(X-1), where $(X-1) contains the main return value. Initially, the size x of the callee's stack frame (the number of its local registers) is directly below $0 on the register stack. This value is replaced by the main return value. After that, the registers are renumbered such that the callee's local registers are again $0, $1, ... and the return values are in registers $X and following (where the $X here is from the previous PUSHJ instruction).

See also:

PUSHJ