Post Reply 
[WP 34S]How to implement an INPUT function
12-12-2013, 12:47 AM
Post: #1
[WP 34S]How to implement an INPUT function
In the old forum under the thread HP35s Calculator Max Rope Tension Program, Thomas Klemm provided a very neat program for the HP 35S in 22 steps.

I was looking to port this to the WP 34S when I realized that on the 34S there is no equivalent of the 35S INPUT function, mostly I presume because the 34S doesn't have the same A-Z alphanumeric variables.

One of the advantages of the 35S INPUT function is that it allows the user to check the value of the variables already stored and to enter only the ones that are changing between two runs of the program.

So I tried to keep the same program user interface by implementing a mapping of the A to Z variables to the 34S global registers 00 to 26.

Here is the result:
  • "INP" is an INPUT equivalent program, expecting a letter from A to Z in the alpha register, prompting the user with a question mark and the current value of the variable and returning with the modified or unmodified value in the X level of the stack.
  • "A" is the Max Rope Tension program, calling "INP" 4 times for the 4 variables L, F, N & D. Then, access to these variables is done through registers 12 (L), 06 (F), 14 (N) and 04 (D). The program is based on the first formula (P = (1 + F)^(N + D - 1)*L*F/((1 + F)^N - 1)) rather than on the second one (P = (1 + F)^(D - 1)*L*F/(1 - (1 + F)^-N)) because the status of the stack after the variable INPUTs make it more efficient.
Code:

001 LBL A
002 CLα
003 αL
004 XEQ'INP'
005 αF
006 XEQ'INP'
007 αN
008 XEQ'INP'
009 αD
010 XEQ'INP'
011 +
012 DEC X
013 INC Y
014 y^x
015 *
016 RCL* 06
017 RCL 06
018 INC X
019 RCL 14
020 y^x
021 DEC X
022 /
023 RTN

024 LBL'INP'
025 LocR 001
026 α->x
027 x->α
028 STO.00
029 CLx
030 #064
031 STO-.00
032 DROP
033 α?
034 VWα+->.00
035 STOP
036 ENTRY?
037 SKIP 001
038 RCL->.00
039 STO->.00
040 CLα
041 RTN
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[WP 34S]How to implement an INPUT function - Didier Lachieze - 12-12-2013 12:47 AM



User(s) browsing this thread: 1 Guest(s)