Arithmetic—How
the
Stack
Does
It
The contents of the stack move up and down automatically as new
numbers enter the
X-register
(lifting
the
stack)
and as operators com
bine two numbers to produceone new number
(dropping
the
stack)
in
the X-register. Suppose the stack is still filled with the numbers 1, 2,
3, 4. See how the stack drops and lifts its contents while calculating
3 +
4-9:
T 1
0
1
1
2
1
E
3
1
Z 2 1 2
1
Y
3
2
7
2
X
4
7
9
-2
1
The
stack
"drops" its
contents.
(The
top
register replicates its contents.)
2
The
stack
"lifts" its
contents.
(The
top
contents
are "lost".)
3
The
stack
drops.
• Notice that when the stack lifts, it pushes the top contents out of
the T-register, and that number is lost.
You
can see, therefore, that
the stack's memory is limited to four numbers for calculations.
• When the stack drops, it replicates the contents of the T-register.
• Because of the automatic movement of the stack, you do not need
to clear the display before doing a new calculation.
• Most functions prepare the stack to lift its contents
when
the
next
number
enters
the
X-register.
See appendix B for lists of functions
that
affect
stack
lift.
38
2:
The
Automatic
Memory
Stack