beautypg.com

Drop (drop from stack) – Echelon Neuron User Manual

Page 96

background image

DROP (Drop from Stack)

The DROP instruction drops a value from one of the stacks:

The DROP [RSP] instruction drops the top of the return stack

The DROP TOS instruction drops TOS

The DROP NEXT instruction drops NEXT

The DROP instruction uses the direct addressing mode.
The DROP instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The DROP instruction requires a single operand to specify which stack element

to drop:

DROP [RSP]

DROP TOS

DROP NEXT

Table 30 describes the attributes of the DROP instruction.

Table 30. DROP Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

DROP [RSP]

F6

1

2

None

DROP TOS

E4

1

3

None

DROP NEXT

E5

1

2

None


Example:
The following example calls a function named clearFlags, which requires three

stack arguments. The function consumes one of the arguments, but does not

consume the others. This example uses the DROP TOS instruction twice to

clear the remaining arguments from the data stack.

push #MSG_CLR ; ( flags, *msg_p, len )

call clearFlags ; ( *msg_p, len, - )

drop TOS ; ( len, -- )

drop TOS ; ( -- )

...

clearFlags

...

ret ; return to caller

86

Neuron Assembly Language Instruction Statements