Stack manipulation – Echelon Neuron User Manual
Page 34
![background image](/manuals/735710/34/background.png)
RSP = old RSP - 2
High
Low
25
01
??
Address of
next sequential
instruction after call
Figure 4. The Return Stack
Stack Manipulation
The Neuron assembly language provides the following instructions to manipulate
the data stack:
•
PUSH to place data from literal data, an address, or a register into the
TOS element of the stack
•
PUSH TOS to copy the value in the TOS element of the stack into the
TOS element (so that it occupies both the TOS and NEXT elements)
•
PUSH NEXT to copy the value in the NEXT element to the TOS element
•
POP to remove data from the TOS element of the stack and place it into
an address or a register
•
ALLOC to allocate space on the stack
•
DEALLOC to deallocate space on the stack
•
DROP to delete data from the TOS element of the stack or from the
NEXT element of the stack
•
INC and DEC to increment and decrement the TOS element on the stack
•
ROLC and RORC to rotate the value in the TOS element on the stack
left or right through the Carry flag
•
SHL, SHLA, SHR, and SHRA to shift the value in the TOS element on
the stack left or right, either logically or arithmetically
•
XCH to exchange the value in the TOS element of the stack with the
value in the NEXT element of the stack
In addition, the Neuron assembly language provides the following instructions to
work with both the data stack and the return stack:
•
PUSHPOP to remove the top element of the return stack and place it
into the TOS element of the data stack
24
Neuron Architecture for Neuron Assembly Programming