Indirect Branch Via Stack - HP 3000 III Series Manual

Table of Contents

Advertisement

Machine Instructions and Stack Operations
The DB,
Q,
and S relative mode, however,
are
unconventional
in
that
they
permit indirect branches through the data stack.
(It
is both illegal and impossible to have a
direct
branch
to
the
stack:
the
coding
of
"01"
for
bits
5 and 6 encodes the Bee
instr uction. )
Figure 4-8 shows an example of the S- relative mode.
Assume that
the instruction
in location
P
specifies the
S- relative mode,
with a displacement of 4,
and indexing.
This causes an indirect
branch
to S-4 in the data stack.
The content of S-4 is then ad-
ded to PB,
thus point ing
at loca tion "a"
in the
code segment.
Since
indexing is
specified,
the value contained
in the Index
Register is also
added to the address being computed.
Thus the
ultimate
effective address
for the branch (next
P)
is location
"a" displaced by the index value.
CODE
DATA
Displacement
4
DB
PB + (S-4)
+
PB + (S-41 +
x
a
S-41
S
t
=
P
a
P8
Next P
Figure 4-8.
Indirect Branch Via Stack
Note particularly that the indirect address given in the stack is
relative to
the program base,
PB,
not to
P as is
usually the
case.
Also note that the displacement is relative to a location
in the stack (DB, Q, or S),
and that indexing
is applied
after
the indirect addressing has been accomplished.
the DB,
Q,
and S
modes depends
on
For DB+,
bits 8 through 15 provide a
For Q+,
bits 9 through
15 provide a
For Q- and S-, bits 10 through 15 pro-
-63.
The displacement
range for
which
mode is
se lected.
range of 0
through +255.
range
of 0 through +127.
vide a range of 0 through
4-24

Advertisement

Table of Contents
loading

Table of Contents