HP 3000 III Series Manual page 158

Table of Contents

Advertisement

Machine Instructions and Stack Operations
The following paragraphs describe the operations of PCAL and EXIT
on a step-by-step basis,
referring to flowcharts.
It
will fre-
quently be assumed that the reader has a working knowledge of the
intents and purposes of the various steps.
PCAL Sequence.
Figure 4-11 illustrates
the
operations
of
the
PCAL instruction.
If
the
call is within the
current segment
(local label),
only the steps shown on the left side of the dia-
gram are
performed.
For calls outside
the current segment,
the
steps on the right side are added.
The first step
is to fetch the program label.
From the PCAL in-
struction
definition, we see that the label can be obtained from
one
0
f two pIace s :
from t he TO S if N is z e r
0 ,
or from PL-N
if N
is not zero.
This operation can be seen in the SCAL operation of
figure 4-10,
where the label is fetched from either
the Segment
Transfer Table, at PL-N, or from the TOS.
Thus, referring to figure 4-11, peAL initially checks N to see if
the label is on the TOS.
If not (block 1), the label
is fetched
fram PL-N and a check is made to see if that location is actually
within the bounds of the Segment Transfer Table. (N must be <STTL
value in the PL location.) If out of STT bounds, an STT violation
is incurred:
otherwise, the PCAL sequence continues.
If the la-
bel is on
the TOS
(block 2),
the label
is put
into temporary
storage in the CPU and S is decremented to delete the label
from
the stack.
At this time,
the CPU has the label but does not know
whether it is local or external, or if it is valid.
The next step is to place a standard four-word stack marker
onto
the stack
(block 3) and update the
Q pointer by loading it with
the content of S (block 4).
Both Q and S are now pointing at the
last word (Delta
Q)
of the new stack marker.
Now the label is checked to see if it is a local label (bit 0=0) .
If it is,
the sequence goes to block 8 (skip to paragraph start-
ing "Block 8 sets").
If the
label is external
(bit 0
=
1),
bits 8
through
15 are
checked
to see if the segment number specified is val ide
If the
segment number does not have an entry in the Code Segment
Table,
a CST
violation is incurred.
Otherwise,
the PCAL sequence con-
tinues.
Next,
absolute addresses
for PB and PL
are calculated
fran the CST entry and loaded into these two register's (block 5) .
Block 6 sets
the privileged mode
in the Status Register
if the
mode bit
in the CST entry
indicates privileged mode,
or if the
caller was executing in privileged mode
(i.e., if the privileged
mode bit
in Status
already was set).
(Although not shown,
the
Reference bit
in the
CST is set at
this
time
for statistical
purposes. )
4-28

Advertisement

Table of Contents
loading

Table of Contents