4.1 Manipulating the evaluation stack
4 Using ST20-C1 instructions
This chapter describes the purpose for which the sequential instructions are intended,
except for the multiply-accumulate instructions, which are described in Chapter 5.
These instructions are described in the context of their intended use. Some instruc-
tions are designed for use in a particular sequence of instructions, so this chapter
describes those sequences. Instructions for exceptions are described in Chapter 6
and multi-tasking instructions are described in Chapter 7.
The architecture of the ST20-C1, including the registers and memory arrangement, is
described in Chapter 3.
4.1 Manipulating the evaluation stack
The evaluation stack consists of the registers Areg, Breg and Creg. The general
action of the evaluation stack is described in section 3.3.1.
Instructions are provided for shuffling and re-order ing the values on the evaluation
stack, as listed in Table 4.1.
Mnemonic
Name
rot
rotate stack
arot
anti-rotate stack
dup
duplicate stack
rev
reverse stack
Table 4.1 Evaluation stack manipulation instructions
rot pops the value from Areg off the evaluation stack and rotates it into Creg, and arot
pushes the value from Creg onto the stack. rev swaps the Areg and Breg, and dup
pushes a copy of Areg onto the stack.
Table 4.2 shows how each of these affects the evaluation stack. Each row shows the
contents of the evaluation stack after one of these instructions is executed if the initial
values of the Areg, Breg and Creg are a, b and c respectively.
Instruction
Areg
Breg
Creg
rot
b
c
a
arot
c
a
b
rev
b
a
c
dup
a
a
b
Table 4.2 Evaluation stack manipulation
Many instructions leave the initial Areg in Creg. This value may be restored into the
Areg by using arot.
30/205
®