beautypg.com

Push (push onto stack) – Echelon Neuron User Manual

Page 112

background image

PUSH (Push onto Stack)

The PUSH instructions push a value from a specified location onto the data

stack. The PUSH instruction uses one of the following addressing modes:

In the indirect relative addressing mode, the PUSH [pointer-

register][offset] instruction pushes the value from the location specified

by adding (using unsigned arithmetic) the contents of the specified

pointer register with the specified offset value into TOS. The value of the

pointer-register expression must be in the range 0 to 3. The offset

expression must resolve at link time to a value in the range 0 to 255.

In the indirect indexed addressing mode, the PUSH [pointer-register]

[TOS] instruction pushes the value from the location specified by adding

(using unsigned arithmetic) the contents of the specified pointer register

with the value of TOS into NEXT. This instruction modifies NEXT but

preserves TOS. The value of the pointer-register expression must be in

the range 0 to 3.

In the direct addressing mode, the PUSH register instruction pushes the

value from the specified CPU register into TOS. The register can be DSP,

FLAGS, or RSP. Because a PUSH instruction always increments DSP,

the value in TOS after a PUSH DSP instruction is one greater than the

original DSP value. And because the FLAGS register contains the Carry

flag, the PUSH FLAGS instruction allows you to inspect the Carry flag.

In the DSP relative addressing mode, the PUSH [DSP][offset]

instruction pushes the value from the stack location (relative to DSP)

specified by offset into TOS. The value of offset must be in the range -1 to

-8. Location -1 corresponds to the first byte on the stack below NEXT.

In the absolute addressing mode, the PUSH address instruction pushes

the value from the absolute address specified by address into TOS.

In the direct addressing mode, the PUSH register instruction pushes the

value from the specified register into TOS. The value of register must be

either TOS or NEXT.

In the immediate addressing mode, the PUSH #number instruction

pushes the value from the specified number into TOS. The expression

number must resolve at link time to a value in the range -128 to +127.

See also PUSHS (Push Short).

In the BP relative addressing mode, the PUSH !byte-register instruction

pushes the value from the specified general-purpose byte register

(R0..R15) into TOS. The byte-register expression must resolve at link

time to a value in the range 8 to 23 for general-purpose byte registers R0

to R15, respectively.

In the indirect addressing mode, the PUSH [RSP] instruction pushes the

byte on the top of the return stack into TOS. The byte on top of the

return stack is not consumed by this instruction and the return stack

pointer (RSP) remains unchanged.

In the BP indexed addressing mode, the PUSH !TOS instruction pushes

the value from a location specified by adding TOS to the contents of the

102

Neuron Assembly Language Instruction Statements