NonStop S-Series Server Description Manual (G06.27+)
TNS Execution Modes
HP NonStop S-Series Server Description Manual—520331-004
6-38
Operations at the Procedure’s Top-of-Stack
Operations at the Procedure’s Top-of-Stack
The top-of-stack area can be addressed implicitly through use of the PUSH and POP
instructions. Implicit addressing means that it is not necessary to specify a mode or a
register. The S register is implied by both instructions; all operations take place at the
top of the memory stack. A word count is used rather than a displacement value.
The PUSH instruction is used to store some or all of the register stack contents to the
top of the memory stack. When a PUSH instruction is executed, the S register setting
is incremented by the number of words pushed. The POP instruction is used to load
one or more of the registers with contents from the top of the memory stack. When the
POP instruction is executed, the loaded words are deleted from the memory stack by
decrementing the S register setting accordingly.
Figure 6-22 illustrates both the PUSH and the POP instructions. In both examples, the
register stack is on the left and the memory stack is on the right. The S register
settings are shown in the middle. The instruction as written, including a three-digit
octal number, is listed at the extreme left. Each digit of the octal number has the
following meanings, in order from most to least significant: (1) the new RP value
following execution, (2) the last register to be stored or loaded, and (3) the count of
registers to be stored or loaded (minus 1). The latter two of these values have the
effect of specifying how many registers are affected and which ones.
In the PUSH example, all eight registers are to be stored. (They contain consecutive
numbers to illustrate storage order.) The number 777 indicates that the count is 8
(specified as 8 minus 1, or 7), that the last register to be stored is R[7], and that RP will
indicate 7 at the end of the instruction. As indicated in the S register settings,
S advances the top-of-stack from G[158] to G[166]. The values are stored in
consecutive memory locations, with the content of R[7] (the value 8) as the last value
to be stored.
In the POP example, four registers are loaded from the top of the memory stack. The
count is 4 (given as 4 minus 1, or 3), and the last register loaded is R[3]. After the four
elements are loaded, the value 8 is in R[3] and the value 5 is in R[0]. The S register
decrements the top-of-stack from 166 to 162 to delete the four elements from the
memory stack.