|Re: HP-41C Commands to RPL|
Message #3 Posted by James M. Prange (Michigan) on 7 Nov 2006, 2:12 a.m.,
in response to message #1 by Gerry Schultz (Los Angeles)
On an RPL model, storage is implemented with named variables,
either local or global.
With the variable-depth stack of RPL, you don't really have to use
variables to store values for later use if you don't want to; you
could leave them on the stack and use stack manipulation commands
to copy or move them to where they're needed. That said, it's
often easier to use local variables.
Any variable, either local or global, can be incremented with the
INCR command or decremented with the DECR command.
Of course values can be incremented with loops too. Within any
loop, you can increment a variable with the INCR command, or a
value on the stack just by adding 1 to it.
With a FOR loop, the loop index is implemented as a local
variable, with the name specified by the user, and accessible by
name within the loop. A FOR...NEXT loop always increments the
index, and with a FOR...STEP loop, the index is increased or
decreased by a user-specified value. START loops are similar, but
the loop index isn't accessible with UserRPL.
I'm not certain what you mean by "stack arithmetic with indirect
storage", but the RPL models do include the commands STO+, STO-,
STO*, and STO/, which work with any variable, local or global. For
example, to subtract 1 from a variable's value, use 'name' 1 STO-,
or to subtract the variable's value from 1, use 1 'name' STO-.
Offhand, I don't see any way to really duplicate the downward
replication of the T register. You could store a value in a
variable (again, local or global) which can furnish an endless
supply of the value simply by calling the variable by name.
Other than that, DEPTH PICK will always copy the topmost stack
level down to level 1. If you want it on level 2 instead, then use
DEPTH PICK SWAP, or for level 3, DEPTH PICK ROT ROT, or on a 49
series, you can replace ROT ROT with UNROT, or for level 4, DEPTH
PICK 4 ROLLD, or for level 5, DEPTH PICK 5 ROLLD, and so on.
Or you could "pre-load" the stack with several copies of an
object. For example, to put 20 copies of the number 5 on the
stack, you could do 1 20 START 5 NEXT. On the 49 series, you could
use the NDUPN command instead, for example, 5 20 NDUPN DROP.
Which RPL model are you using?