06-30-2019, 03:27 PM
(06-30-2019 09:06 AM)Arch Wrote: [ -> ]@Gene222I have a suggestion for 1. but it involves the use of a user key.
Hi,
I tried your code once more.
[...]
Modified it a tiny bit. Just two questions:
1. The program returns only the last result to the stack when you exit it. I want to calculate several times and use each result for further calculations in RPN. Is there a way that all the previous results are returned to the stack for further use in RPN?
2. While the code works fine on the virtual calculator, I got problems on the real one. The following actions will result in a shutdown of the calculator ("Your calculator has a problem and will be rebooted in 3 seconds"):
a. hitting <enter> several times after a calculation
b. pressing exit after a calculation
Do you have any suggestions?
Thanks
Arch
A user key allows to return a string unquoted to the command line. Pressing enter then executes the contents of the string.
By passing a string such as " s4 s3 s2 s1" ,the vars are each sent to a level of the stack.
In this demo program I read 4 levels of the stack , multiply them by 2 , and pass the results back to 4 stack levels, pushing the original data up.
To run , enter data into 4 stack levels, then <shift user 4> and <enter>
Code:
EXPORT s4,s3,s2,s1;
KEY K_4()
BEGIN
2▶Entry;
Ans(1)*2▶s1;
Ans(2)*2▶s2;
Ans(3)*2▶s3;
Ans(4)*2▶s4;
RETURN "s4 s3 s2 s1";
END;
You could customise the key definition in your program to return the vars you need, then execute the user key followed by enter to return your data to the stack