WP43 News

This area is for discussion about these families of custom high-end Scientific Calculator applications for SwissMicros devices.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

dlachieze wrote:
Wed Jan 05, 2022 2:10 pm
1. Does this means that the register K acts as a temporary Alpha register (like the one we have on the 41C / 42S / 34S)?
2. On the windows emulator the text string entered in a program step goes to X and not to K . What is the correct behavior?
(Numbers added)
  1. To some extent, yes. Please see p. 238. For long I thought we could do without a dedicated alpha register since each and every register is capable holding an alphanumeric string. Some special programming functions like KEYG and KEYX, however, seem to require such a register – else handling these functions would become more complicated than it was on the HP-42S.
  2. It doesn't really matter. I think X may be a little easier to handle. Thanks for reporting. 15 points more for you.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

Walter wrote:
Wed Jan 05, 2022 6:54 pm
2. It doesn't really matter. I think X may be a little easier to handle. [/list]
Well let's look to a use case when a program has to return results within strings, using the example on page 201 of the OM about a train arrival time.
So your program has calculated the exact arrival time and you have 23:55 in X, now let's look at the two cases (X or K):

A. Strings in program steps are sent to K as described in the OM, here are the program steps to build the result string:

Code: Select all

001 'The train will arrive at '      @ this string will be sent to K - K='The train will arrive at '
002 STO+ K                           @ the result in X is concatenated to the string in K - K='The train will arrive at 23:55' 
003 RCL K                            @ AFAIK there is no Append character on the 43S as on the 41C or 42S to append directly a  string to K
004 ' sharp at Victoria station.'    @ this string will be sent to K - K=' sharp at Victoria station.' 
005 RCL+ K                           @ the string is K is concatenated to the string in X, we have now the full result string in X:
                                     @ 'The train will arrive at 23:55 sharp at Victoria station.' 
B. Strings in program steps are sent to X as currently implemented, which is similar to RPL where everything is done on the stack:

Code: Select all

001 'The train will arrive at '      @ this string will be sent to X - X='The train will arrive at ' -  Y=23:55
002 X<>Y                             @ We need to have the string in Y
002 +                                @ the result in X is concatenated to the string in Y - X='The train will arrive at 23:55' 
004 ' sharp at Victoria station.'    @ this string will be sent to X - X=' sharp at Victoria station.' - Y='The train will arrive at 23:55' 
005 +                                @ the string in Y is concatenated to the string in X, we have now the full result string in X:
                                     @ 'The train will arrive at 23:55 sharp at Victoria station.' 
For comparison, the same thing with an Alpha register as on the 41C/42S takes only 3 steps and don't touch the stack:

Code: Select all

001 'The train will arrive at '      @ this string will be sent to Alpha - Alpha='The train will arrive at ' -  Y=23:55
002 ARCL X                           @ the result in X is concatenated to the string in Alpha - Alpha='The train will arrive at 23:55' 
003 'ᵀ sharp at Victoria station.'   @ the string is concatenated to the string in Alpha, we have now the full result string in Alpha:
                                     @ 'The train will arrive at 23:55 sharp at Victoria station.' 
I find A et B quite cumbersome. A could be done in 3 steps if we had an Append character but B requires anyway the extra X<>Y and changes the stack content, so if you want to reuse the result for further calculation you need to save it somehow which is an additional step.

Is there any other simpler way to do this on the 43S?
DM42: 00425 - DM41X: β00066 - WP43: 00042
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

Please let me try. There are some facts to be taken into account:
  • Any register can take a text string of up to 196 characters.
  • If you want to append a string to another one, press [+]. No append-character needed.
  • If you need objects more than once, store them in a register or variable.
Now to our London example with the arrival time in X and string constants in X:

Code: Select all

001 'The train will arrive at '
002 x<->y
003 +					@ add the computed time to the first part of the sentence
004 ' sharp at Victoria station.'
005 +					@ now we have the entire sentence in X
This is brute force. If, however we want the program to output messages for various times, the following approach may be a bit smarter:

Code: Select all

001 'The train will arrive at '		@ initialisation
002 STO A
003 ' sharp at Victoria station.'
004 STO B
...
005 RCL A
006 RCL+ time
007 RCL+ B				@ now we have the entire sentence in X
Please tell me if I missed something.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

Brute force ??? If you just want to have a nice output of a result at the end of a program I don’t see a simpler way. Your proposal has 2 additional steps.
DM42: 00425 - DM41X: β00066 - WP43: 00042
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

Well, maybe brute force wasn't the best denotation. Anyway, there's no major difference between the K- and X-solution for a one-time output. And that was my claim.

I don't really like special single purpose registers like alpha in the HP-42S. They tend to carry special commands with them. I prefer general purpose registers and commands if I have a choice.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

I've thought about it and I've found a simpler way to do it for the X-solution: 4 steps while keeping the original value of X in Y, which makes the X-solution simpler than the K-solution.

Code: Select all

001 'The train will arrive at '
002 RCL+ Y                              @ add the computed time to the first part of the sentence
003 ' sharp at Victoria station.'
004 +					@ now we have the entire sentence in X, and the time in Y
However when testing it failed as currently RCL+ Y is not working: it does the same as RCL+ X.
DM42: 00425 - DM41X: β00066 - WP43: 00042
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

There is no AIP instruction in the 43S. The reference manual says page 177:
"AIP Dispensable You can merge text and numeric data easily using + as described in OMS 2."

Well, it's not so easy to replace AIP with + !!

Let say you have a decimal number in X and you want to add it's integer part to a string, which you can do in a single instruction with AIP (without disturbing the stack nor the display mode).
As far as I can see, if you want to do the same thing with + you need to:
  • Save the stack
  • Save the display mode
  • Set Fix 00
  • Get the integer part of X
  • Add it to the string
  • Rotate the string one character to the right
  • Remove the decimal separator from the string with α→x
  • Restore the display mode
  • Restore the stack
DM42: 00425 - DM41X: β00066 - WP43: 00042
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

I think it's a bit easier since IP returns an integer:

Code: Select all

STOS
IP
+
STO string
RCLS
BTW, your method won't work since you didn't save the resulting string anywhere.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

Walter wrote:
Thu Jan 06, 2022 7:00 pm
I think it's a bit easier since IP returns an integer
Interesting, I didn’t realize that the display format (such as FIX 02 or ENG 03) doesn’t apply to the result of IP.
Walter wrote:
Thu Jan 06, 2022 7:00 pm

Code: Select all

STOS
IP
+
STO string
RCLS
BTW, your method won't work since you didn't save the resulting string anywhere.
Yes, if the original string is in Y then the resulting string has to be stored somewhere unless it is displayed with VIEW before restoring the stack, assuming that executing VIEW during program execution on the 43S works the same way as on the 42S.

Btw, did you notice the issue I reported above regarding RCL+ Y?
DM42: 00425 - DM41X: β00066 - WP43: 00042
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

dlachieze wrote:
Thu Jan 06, 2022 8:01 pm
Walter wrote:
Thu Jan 06, 2022 7:00 pm
I think it's a bit easier since IP returns an integer
Interesting, I didn’t realize that the display format (such as FIX 02 or ENG 03) doesn’t apply to the result of IP.
These formats apply to real numbers. Integers are different. They have no decimal separator, for example. ;)
dlachieze wrote:
Thu Jan 06, 2022 8:01 pm
Walter wrote:
Thu Jan 06, 2022 7:00 pm
BTW, your method won't work since you didn't save the resulting string anywhere.
Yes, if the original string is in Y then the resulting string has to be stored somewhere unless it is displayed with VIEW before restoring the stack, assuming that executing VIEW during program execution on the 43S works the same way as on the 42S.
AFAIK it does.
dlachieze wrote:
Thu Jan 06, 2022 8:01 pm
Btw, did you notice the issue I reported above regarding RCL+ Y?
Yes, though I didn't check yet. Anyway, you get 15 points more.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Post Reply