beautypg.com

Echelon Neuron User Manual

Page 119

background image

PUSHPOP (Pop from Return Stack and Push onto

Data Stack)

The PUSHPOP instruction pops the byte from the top of the return stack and

pushes it into TOS on the data stack. The PUSHPOP instruction uses the

implicit addressing mode.
You can also use the PUSH [RSP] instruction to save the value at the top of the

return stack without removing it.
See POPPUSH (Pop from Data Stack and Push onto Return Stack) for the

inverse operation.
The PUSHPOP instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The PUSHPOP instruction requires no operands:

PUSHPOP

Table 43 describes the attributes of the PUSHPOP instruction.

Table 43. PUSHPOP Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

PUSHPOP

A7

1

5

None


Example:
The following example uses the POPPUSH instruction to save the contents of

the top of the stack so that it can store other values onto the stack below the top

values. It then uses the PUSHPOP instruction to restore the values to the top

of the stack. The comments show the contents of the data stack and the return

stack for each operation.

poppush ; (A--) R(B--)

poppush ; (--) R(A, B--)

pushd [C] ; (A --) R(A, B --)

pushd [D] ; (D, C --) R(A, B --)

pushd [E] ; (E, D, C --) R(A, B --)

pushpop ; (A, E, D, C -- ) R( B -- )

pushpop ; (B, A, E, D, C -- ) R( -- )

Neuron Assembly Language Reference

109