Re: RPL: STO removes tags Message #3 Posted by C.Ret on 13 Mar 2012, 4:48 p.m., in response to message #2 by Gilles Carpentier
Bonsoir Gilles
Your idea to store object as string trigger me.
There is a simpler way to leave arguments when using STO instruction.
Suppose you are on the way to compute . But you know you will have to use very soon in further computations.
In RPN calculator, you may certainly spare typing by storing the specific value of on the fly during the calculation of phi:
Keys strokes Calculator Display Remarks
1 [ENTER^] 1.0000 Start phi computation
5 [ SQRT ] 2.2361 Specific value displayed
[ STO ] [ 0 ][ 5 ] 2.2361 STOre specific value ‘on the fly’
[ + ] 3.2361 Continue computation
2 [ / ] 1.6180 Get final result (phi).
On RPL system, as STO consumes arguments from stack, it make the specific valu disappear. To store it ‘on the fly’, duplicate have to be made to keep it in stack: (suppose 4 FIX and ‘R05’ use as 5th register
Keys strokes System Display Remarks
1 [ENTER] 1.0000 Start phi computation
5 [ SQRT ] 2.2361 Specific value displayed
[ENTER] ‘R05’ [ STO ] 2.2361 STOre specific value ‘on the fly’ need several more key strokes
[ + ] 3.2361 Continue computation
2 [ / ] 1.6180 Get final result (phi).
A few years ago, to use ‘store on-the-fly’ of numerical on my HP-28S, I wrote these 3 short instruction :
ClRegs to clear numeric registers (all register R00 to R99 set to zero)
STOR to store one numerical into a register (no extra ENTER to duplicate)
RCLR to recall one numerical from a register
KEY2D to get two digits from keyboard (sub-routine of both STOR and RCLR).
ClRegs: « { 100 } 0 CON ‘REGS’ STO »
STOR: « ‘REGS’ “STO ” KEY2D 3 PICK ->NUM PUT » @ ->NUM is optional
RCLR: « ‘REGS’ “RCL ” KEY2D GET »
KEY2D:
« -> Msg @ Message string used to display STO -- or RCL --
« “”
DO
Msg OVER “__” + 1 2 SUB + 4 DISP @ “_” is 95 CHR
DO UNTIL KEY END
IF DUP “BACK” == @ “BACK” is left-arrow used to restart entry
THEN DROP2 “”
ELSE IF DUP “0” >= OVER “9” <= AND @ “0” to “9”: only numerical entry allowed
THEN +
ELSE DROP @ remova any bad entry
END
END
UNTIL DUP SIZE 2 == END @ two digit (100 register 00 to 99)
Msg OVER + 4 DISP @ optinal : shortly display last key before quitting
STR-> 1 +
CLMF @ restore standard stack view display
»
Usage :
[pre]
Keys strokes Calculator Display Remarks
1 [ENTER] 1.0000 Start phi computation
5 [ SQRT ] 2.2361 Specific value displayed
[ STOR ] STO __
[ 0 ] STO 0_
[ 5 ] 2.2361 STOre specific value ‘on the fly’
[ + ] 3.2361 Continue computation
2 [ / ] 1.6180 Get final result (phi).
Isn’t RPL’s “store in the fly” as cool as RPN ?
|