David Westbrook
These programs are designed to help in understanding the
operation of AMPLE words which change the number stack (such as #2, #*, #11). I
always find these operations confusing to follow and so I wrote the programs to
help me see what's going on.
All number operations in AMPLE depend on a data structure
called the 'stack'. This is quite literally a pile of numbers, so that any
number entered goes on the top of the stack and any operation which needs a
number takes it from the top of the stack. Some AMPLE commands, such as FRAME, let
you get at numbers below the top.
Stack Window
LOAD and RUN "U.STKWIN". The program displays the
contents of the stack and allows you to directly enter commands (basically, any
of the '#' commands are the main focus) and see their effect.
The screen shows the stack as it was before your command on
the left, and the state after your command on the right.
Enter some numbers first (separated by spaces) and press
RETURN. Your command is displayed under 'Last command:' and the right-hand
display shows the numbers on the stack.
Now try any stack-altering command (e.g. #11, # 213, #2 or
#/). The left-hand display alters to show the previous stack whilst the right
shows the result. Entering 'Q' will quit the program.
Stack Monitor
The word 'showstack' is the guts of the Window program and
this can easily be modified so that you can *EXEC it into any other program and
then call it up at any point to monitor the stack.
The file "U.STKMON" should be *EXECed into the
program you want to monitor. Insert the word 'stk' at any point in your program
where you want to see the state of the stack (I'm afraid I haven't bothered to
write a routine to preserve the screen, so any display will be destroyed).
Related files on this disc:
Published in AMPLINEX 004, March 1988