11.7. Real Stack Machines.   

In PL0 if we want to increment a variable:


LOD 0,ADR
LIT 0,1
ADD
STO 0,ADR i i+1

On a real STACK MACHINE such as PDP11 we could simply use


INC ADR2(SP) i i+1

i.e. increment by 1 the value of variable offset from the top of the STACK by value ADR2. Or

INC ADR(B)

All types of arithmetic operations can be done on the stack with or without changing the top of stack register.

j i; LOD 0,ADRi
--> STO 0,ADRj

      k  i;     LOD  0,ADRi

STO 0,ADRk

Variable i is used both times so it would be nice if we don't "destroy" it

LOD 0,ADRi
COPY 0,ADRj
COPY 0,ADRk LOD 0,ADRk

       MOV  ADRi(B),ADRj(B)

MOV ADRi(B),ADRk(B)

           on PDP 11

No manipulation of top of STACK which practically is too limited.