Stacking the Calculator

Publication

Pub Details

Date

Pages

See all articles from CATS v6 n1

In writing programs in Machine Code it is sometimes necessary to bring in data from a BASIC program or from direct input.

A simple way is to go to M/C with RANDOMIZE X+USR 65000. That puts X on the calculator stack, from which it may be drawn and used within the M/C program. X may be a variable or numerals.

That approach may be expanded to stack several numbers. Just include "X+(...)" for each added number. For example:

RANDOMIZE X3+(X2+(X1+USR 65000))

will put three numbers on the stack, with X1 “on top”.

At the end of the M/C program add a line:"EF A0....38", with one A0 for each + sign in the entry. The A0’s put 0’s on the stack to replace the numbers originally stacked and then used in the M/C program.