next up previous contents
Next: Scan arithmetic Up: OUTLINE OF FACILITIES Previous: Initialization   Contents

Moving spectra around

SET-STACK Define length and number of stack registers
CLEAR-STACK Initialize stack registers to all empty
ROLL-STACK Y$\rightarrow$X, X$\rightarrow$T etc
PUSH-STACK-UP X$\rightarrow$X,Y, Y$\rightarrow$Z, etc
POP-STACK-DOWN Pop stack down (T$\rightarrow$T-1, Z$\rightarrow$Y, Y$\rightarrow$X)
XY-INTERCHANGE Swap X and Y register contents
SHOW-STACK Show contents of current stack registers
   
STORE-SPECTRUM Copy current X-register spectrum to storage register
RECALL-SPECTRUM Push stack, retrieve storage register to X-register
SHOW-STORE-REGISTERS Show contents of current storage registers

The program operates in a very similar way to an HP-45 calculator. Reading a spectrum automatically causes the stack to be pushed to create space for it. The stack can be moved up or down using PUSH or POP. ROLL first POPs, then puts the previous current scan into the top-of-stack position. XY interchanges the bottom (i.e. two most recently read) spectra.

It may be helpful to find out how many stack positions are currently in use, and what's in them. This may be determined using SHOW-STACK, which uses Hewlett-Packard notation for the stack positions, i.e. X , Y and Z for the first (bottom) three positions, T for the last (top) position, and 4 thru n-1 for intermediate positions if any. If you want to alter the length or number of stack registers, use SET-STACK. Note that the length of stack registers need not be the same as the data length - equal to or greater is fine, although for the fixed amount of memory allocated to the stack at present you get more possible stack positions if you make them shorter. The stack can be ``zeroed" or cleared (reset to empty) using CLEAR-STACK.

As well as the stack registers 5 other storage registers are available, and are accessed with the STORE-SPECTRUM and RECALL-SPECTRUM commands. Note that the storage register 5 is sometimes used by the rest of the program as a buffer for reduction operations, and so must be regarded as volatile memory.


next up previous contents
Next: Scan arithmetic Up: OUTLINE OF FACILITIES Previous: Initialization   Contents
Jamie Leech 2004-08-16