HP 3000 III Series Manual page 167

Table of Contents

Advertisement

Machine Instructions and Stack Operations
The count
field for
Read and
write orders
contains the
least
significant
12
bits of a negative two's complement count value.
The count is a word count,
independent of the particular record-
ing format
(bytes,
words,
or
records).
For a
Control order,
these
l2
bits are used for control information in addition to
th~
16 bits in the IOAW (a total of 28 bi ts) .
'4-17.
STACK OPERATION EXAMPLES
4-18. Basic Arithmetic
Figure 4-15 shows a sequence of basic instructions being executed
on some data
which is presumed to exist in the stack.
The upper
row
shows the most elementary method of adding' and removing data
to and
from the
stack via
load and
delete instructions.
The
lower
row shows the effects of four arithmetic instructions.
As
shown for the initial stack condition (A),
the data
consists of
six
numbers in six consecutive locations.
The
Q
Register points
to the oldest element of the group,
and S points to
the element
currently on the TOS.
A Delete instruction (DEL),
executed be-
tween (A) and (B),
causes the number
44 to be removed
from the
stack.
This is accomplished by simply decrementing the S-pointer
by one.
Then, between (B) and (C), a LOAD instruction causes the
number 37 to be
loaded onto the stack.
This is accomplished by
storing the
number 37
(from another
memory location)
into the
location formerly occupied by the number 44 and then incrementing
the S-poin te r by one.
Between
(C) and
(D) an ADD instruction
is executed.
This in-
struction adds
the two top
elements of the
stack together, de-
letes both
from the stack,
places the answer (100) on
the TOS,
and points S at the answer.
Note
As previously discussed, up
to
four
of
the
top stack elements may exist
in CPU registers.
Obviously, to
ex-
ecute
the
ADD instruciton, at least
the two top elements
must
exist
in
the
CPU.
To ensure that this is the
case, the hardware
checks
the
con-
tents
of
the
SR Re giste r •
I f the
contents of the SR Register is not at
least two, one or more memory fetches
will be made so that the
instruction
can be carried out.
Between
(D) and
(E) a Multiply instruction
(MPY)
is executed.
This instruction
mUltiplies the
two top
elements of
the stack
together, deletes both from the stack, places the answer (700) on
the TOS and points S at the answer.
4-37

Advertisement

Table of Contents
loading

Table of Contents