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
12-12-2013, 08:08 AM
Post: #2
RE: [WP 34S]How to implement an INPUT function
I understand that there is no more space available for new functions but it would be cool to be able on the WP 34S to access global registers via letters, for example: RCL αL recalling global register 012.
Find all posts by this user
Quote this message in a reply
12-13-2013, 11:08 PM (This post was last modified: 12-13-2013 11:14 PM by Marcus von Cube.)
Post: #3
RE: [WP 34S]How to implement an INPUT function
RCL αA as a synonym for RCL 01 does not fit easily into our encoding scheme:
  • A single command has 16 bits.
  • 8 Bits are reserved for the argument in the argument taking commands.
  • The command defines whether indirection is supported or not.
  • Some commands such as α have special handling.
  • The memory commands allow indirection and local registers which limits the argument range from 0 to 127.
  • Local and stack registers are defined by their argument value (from 100 to 127).
  • There are many more commands then STO and RCL which deal with registers.
There is simply no space in this encoding scheme to add another representation as suggested by you. Another issue would be the user interface on the calculator. You need a way to input such commands...

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
12-14-2013, 06:57 AM (This post was last modified: 12-15-2013 08:21 AM by Paul Dale.)
Post: #4
RE: [WP 34S]How to implement an INPUT function
Marcus is correct. We've basically exhausted the command encoding on the 34S. The triple alpha arguments are a bit of a hack that caused a lot more trouble than they originally appeared to. This will be completely redesigned for the 43S. We could add more functions, but each would have to be carefully justified and I can't see how the 35S INPUT function would fit.

The 34S has a plethora of input commands. Want to display a value, an alpha string and wait for user input? We've got commands for that. Even though there is nothing exactly equivalent to the 35S INPUT command, we have sufficient flexibility to implement reasonable input schemes. In fact, I'd even go as far as saying better. The 35S INPUT is fairly restricted -- why a single letter when you can display a proper name?


- Pauli
Find all posts by this user
Quote this message in a reply
12-15-2013, 06:15 AM
Post: #5
RE: [WP 34S]How to implement an INPUT function
Bonjour Didier,

Pauli is right. Please also see pp. 80f in the printed manual.

d:-)
Find all posts by this user
Quote this message in a reply
12-15-2013, 04:15 PM
Post: #6
RE: [WP 34S]How to implement an INPUT function
Marcus, Pauli & Walter, many thanks for your answers. I understand that the current implementation is pushing the 30b to it's limits and even beyond ...

While the 35S alphanumeric variables (coming I think from the 32S) make for simple formula programming, the 34S is much more powerful with some inherent complexity...

I'm looking forward to the wonders you'll do with the 43s Smile
Find all posts by this user
Quote this message in a reply
Post Reply 




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