Post Reply 
Valentin Albillo's "Boldly Going... Going Back to the roots" now for the HP-41 !
04-20-2024, 10:43 AM (This post was last modified: 04-20-2024 10:45 AM by Vincent Weber.)
Post: #21
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
Thanks Angel, very interesting!
Knowing that my "HEPAX trick" was not available back in the day, well at least until 1988 which is very late in the '41 life, I made a version using the Advantage pack complex routines. At least they were available in a ROM module (so you can use XROMs) by 1985.
I got consternated by the results. As slow as with JMB routines when they reside in main memory, so with the global searches! These routines are terrible, using up to 4 registers, plenty of calls back and forth, not optimised the slightest bit, unsuitable for loops. JMB routines are also in user code, but at least he bothered to make them straightforward and reasonably fast.
It is a really pity that the Advantage pack does not contain the full 15C functionality in MCODE. If HP could commission Firmware specialists to adapt the 15C SOLVE and INTEG routines for the '41, why not going all the way, and also adapt the complex stacks (improved with complex STO and RCL), hyperbolics, Gamma, combinations and permutations, and random numbers?
The matrix routines on the Advantage pack are outstanding, more powerful than the 15C, but they were made by the CCD, not by HP.
This Advantage ROM is a half-baked product, too little too late. Hp was already showing signs of decadence by 1985...
Find all posts by this user
Quote this message in a reply
04-21-2024, 06:53 PM
Post: #22
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
Hi Vincent, I agree 101% with your assessment on the complex routines in the Advantage and with your comments. I know the 41Z wasn't there back then but hey, it is here right now... so I'll prepare a tweaked version replacing the calls to JMB's routines with the 41Z counterpart, stay tuned.

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
04-21-2024, 06:57 PM
Post: #23
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
(04-21-2024 06:53 PM)Ángel Martin Wrote:  Hi Vincent, I agree 101% with your assessment on the complex routines in the Advantage and with your comments. I know the 41Z wasn't there back then but hey, it is here right now... so I'll prepare a tweaked version replacing the calls to JMB's routines with the 41Z counterpart, stay tuned.

Great, Thanks Angel!

Cheers
Find all posts by this user
Quote this message in a reply
04-21-2024, 07:27 PM (This post was last modified: 04-21-2024 07:31 PM by Ángel Martin.)
Post: #24
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
it's done, quite easy since it's almost a one-by-one replacement...

but the choice of those real data registers is very inefficient (it requires multiple ZENTER^ instructions sprinkled throughout the program).

If I understand your description you used:

R01 and R24
R02 and R25
R03 and R36
etc...

for real and imaginary parts?

Redoing that to use adjacent (contiguous) numbered registers will eliminate the need for all those ZENTER^, abd thus reduce the execution time even further...

Code:
 9:24PM 04/21
 01*LBL "RZVA"
 02*LBL 01
 03 STO 24
 04 RDN
 05 STO 01
 06 1 E-4
 07 STO 19
 08 X^2
 09 STO 20
 10 ,5
 11 STO 25
 12*LBL 02
 13 XEQ IND 00
 14 0
 15 RCL 25
 16 Z/
 17 STO 21
 18 RDN
 19 STO 02
 20 RCL 19
 21 ST+ 24
 22 XEQ IND 00
 23 STO 22
 24 RDN
 25 STO 03
 26 RCL 19
 27 ST- 24
 28 ST- 24
 29 XEQ IND 00
 30 STO 23
 31 RDN
 32 STO 04
 33 R^
 34 RCL 03
 35 RCL 22
 36 Z+
 37 ZENTER^
 38 RCL 02
 39 RCL 21
 40 Z-
 41 ZENTER^
 42 0
 43 RCL 20
 44 Z/
 45 STO 06
 46 RDN
 47 STO 05
 48 RCL 03
 49 RCL 22
 50 ZENTER^
 51 RCL 04
 52 RCL 23
 53 Z-
 54 ZENTER^
 55 0
 56 RCL 19
 57 ST+ 24
 58 Z/
 59 ZENTER^
 60 0
 61 RCL 25
 62 Z*
 63 STO 23
 64 RDN
 65 STO 04
 66 RCL 06
 67 RCL 05
 68 ZENTER^
 69 RCL 04
 70 RCL 23
 71 Z/
 72 STO 22
 73 RDN
 74 STO 03
 75 R^
 76 ZENTER^
 77 RCL 02
 78 RCL 21
 79 Z*
 80 ZENTER^
 81 RCL 04
 82 RCL 23
 83 Z/
 84 1
 85 -
 86 CHS
 87 X<>Y
 88 CHS
 89 X<>Y
 90 RCL 25
 91 Z^X
 92 1
 93 -
 94 ZENTER^
 95 RCL 03
 96 RCL 22
 97 Z/
 98 ST+ 24
 99 RDN
100 ST+ 01
101 R^
102 ZENTER^
103 RCL 01
104 RCL 24
105 Z/
106 R-P
107 RCL 20
108 X<Y?
109 GTO 02
110 RCL 01
111 RCL 24
112 R-P
113 RDN
114 STO 23
115 SIN
116 ABS
117 RCL 20
118 X<=Y?
119 GTO 03
120 RCL 23
121 COS
122 ENTER^
123 ABS
124 X#0?
125 /
126 RCL 01
127 RCL 24
128 R-P
129 X<>Y
130 RDN
131 *
132 STO 24
133*LBL 03
134 RCL 01
135 RCL 24
136 ZAVIEW
137 END

and:

Code:
 9:28PM 04/21
 01*LBL "ZZ"
 02 RCL 01
 03 RCL 24
 04 ZENTER^
 05 W^Z
 06 ZRCL 4
 07 Z-
 08 END

in the last part you see that ZRCL 4 is equivalent to {RCL 08, RCL 09, ZENTER^}

Cheers,
ÁM

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
04-21-2024, 07:35 PM
Post: #25
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
(04-21-2024 07:27 PM)Ángel Martin Wrote:  it's done, quite easy since it's almost a one-by-one replacement...

but the choice of those real data registers is very inefficient (it requires multiple ZENTER^ instructions sprinkled throughout the program).

If I understand your description you used:

R01 and R24
R02 and R25
R03 and R36
etc...

for real and imaginary parts?

Redoing that to use adjacent (contiguous) numbered registers will eliminate the need for all those ZENTER^, abd thus reduce the execution time even further...

Code:
 9:24PM 04/21
 01*LBL "RZVA"
 02*LBL 01
 03 STO 24
 04 RDN
 05 STO 01
 06 1 E-4
 07 STO 19
 08 X^2
 09 STO 20
 10 ,5
 11 STO 25
 12*LBL 02
 13 XEQ IND 00
 14 0
 15 RCL 25
 16 Z/
 17 STO 21
 18 RDN
 19 STO 02
 20 RCL 19
 21 ST+ 24
 22 XEQ IND 00
 23 STO 22
 24 RDN
 25 STO 03
 26 RCL 19
 27 ST- 24
 28 ST- 24
 29 XEQ IND 00
 30 STO 23
 31 RDN
 32 STO 04
 33 R^
 34 RCL 03
 35 RCL 22
 36 Z+
 37 ZENTER^
 38 RCL 02
 39 RCL 21
 40 Z-
 41 ZENTER^
 42 0
 43 RCL 20
 44 Z/
 45 STO 06
 46 RDN
 47 STO 05
 48 RCL 03
 49 RCL 22
 50 ZENTER^
 51 RCL 04
 52 RCL 23
 53 Z-
 54 ZENTER^
 55 0
 56 RCL 19
 57 ST+ 24
 58 Z/
 59 ZENTER^
 60 0
 61 RCL 25
 62 Z*
 63 STO 23
 64 RDN
 65 STO 04
 66 RCL 06
 67 RCL 05
 68 ZENTER^
 69 RCL 04
 70 RCL 23
 71 Z/
 72 STO 22
 73 RDN
 74 STO 03
 75 R^
 76 ZENTER^
 77 RCL 02
 78 RCL 21
 79 Z*
 80 ZENTER^
 81 RCL 04
 82 RCL 23
 83 Z/
 84 1
 85 -
 86 CHS
 87 X<>Y
 88 CHS
 89 X<>Y
 90 RCL 25
 91 Z^X
 92 1
 93 -
 94 ZENTER^
 95 RCL 03
 96 RCL 22
 97 Z/
 98 ST+ 24
 99 RDN
100 ST+ 01
101 R^
102 ZENTER^
103 RCL 01
104 RCL 24
105 Z/
106 R-P
107 RCL 20
108 X<Y?
109 GTO 02
110 RCL 01
111 RCL 24
112 R-P
113 RDN
114 STO 23
115 SIN
116 ABS
117 RCL 20
118 X<=Y?
119 GTO 03
120 RCL 23
121 COS
122 ENTER^
123 ABS
124 X#0?
125 /
126 RCL 01
127 RCL 24
128 R-P
129 X<>Y
130 RDN
131 *
132 STO 24
133*LBL 03
134 RCL 01
135 RCL 24
136 ZAVIEW
137 END

Cheers,
ÁM
Yes, when I adapted Valentin's program I wanted to reduce the risk of errors, so whenver he used variable X for instance, I used the corresponding letter number for the real part (here 24) and I used the registers as needed going forward for the imaginary parts (so here: 1), leaving 00 free to store the function's name. But please double check, I might not have gone in order 100% of the times. Best is to check the RCLs... When I did this I had not 41Z and consecutive registers in mind, it didn't matter Smile
How long does it take to solve with R=PI?

Cheers
Find all posts by this user
Quote this message in a reply
04-22-2024, 08:48 AM (This post was last modified: 04-22-2024 09:00 AM by Ángel Martin.)
Post: #26
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
G'morning, with the register number changes done the execution takes just 40 seconds on V41 (using 41Z functions), or about 2 seconds in Turbo mode. Much better, saves about one minute.


Here's how the registers changed:
Code:
R25 -> R01
R01 -> R03   - ZR 01
R24 -> R02
R02 -> R05   - ZR 02
R21 -> R04
R03 -> R07   - ZR 03    
R22 -> R06
R04 -> R09   - ZR 04
R23 -> R08
R05 -> R11   - ZR 05        
R06 -> R10
R19 -> R12
R20 -> R13

And here's the new program listing:

Code:
01*LBL "RZVA"
 02 ASTO 00
 03*LBL 01
 04 ZSTO 01
 06  E-4
 07 STO 12
 08 X^2
 09 STO 13
 10 ,5
 11 STO 01
 12*LBL 02
 13 XEQ IND 00
 14 RCL 01
 15 ST/ Z
 16 /
 17 ZSTO 02
 19 RCL 12
 20 ST+ 02
 21 XEQ IND 00
 22 ZSTO 03
 24 RCL 12
 25 ST- 02
 26 ST- 02
 27 XEQ IND 00
 28 ZSTO 04
 30 ZRC+ 03
 32 ZRC- 02
 34 RCL 13
 35 ST/ Z
 36 /
 37 ZSTO 05
 39 ZRCL 03
 41 ZRC- 04
 43 RCL 12
 44 ST+ 02
 45 ST/ Z
 46 /
 47 RCL 01
 48 ST* Z
 49 *
 50 ZSTO 04
 52 ZRCL 05
 54 ZRC/ 04
 56 ZSTO 03
 58 ZRC* 02
 60 ZRC/ 04
 62 1
 63 -
 64 CHS
 65 X<>Y
 66 CHS
 67 X<>Y
 68 RCL 01
 69 Z^X
 70 1
 71 -
 72 ZRC/ 03
 74 ZST+ 01
 76 ZRC/ 01
 78 R-P
 79 RCL 13
 80 X<Y?
 81 GTO 02
 82 ZRCL 01
 84 R-P
 85 RDN
 86 STO 08
 87 SIN
 88 ABS
 89 RCL 13
 90 X<=Y?
 91 GTO 03
 92 RCL 08
 93 COS
 94 ENTER^
 95 ABS
 96 X#0?
 97 /
 98 RCL 03
 99 RCL 02
100 R-P
101 X<>Y
102 RDN
103 *
104 STO 02
105*LBL 03
106 ZRCL 01
108 ZAVIEW
109 END

See attached the RAW file in case you want to try it on your V41 environment...

It possibly can be further tweaked to squeeze a few more seconds off the timing, specially the final part - feel like taking a stab at it?

That was fun , thanks for the cues. BTW this version will go into a new module I'm putting together, credits will state "Albillo-Weber-Martin"

Cheers,
ÁM

PS. note that the "R" constant (pi in the example) now cannot be stored in R08, R09. I used PI facevalue since subtracting a real value from a complex number only involves its real part.:

01*LBL "ZZ"
02 ZRCL 01
04 ZENTER^
05 W^Z
06 PI
07 -
08 END


Attached File(s)
.zip  RZVA-V3.zip (Size: 272 bytes / Downloads: 2)

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
04-22-2024, 08:53 AM
Post: #27
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
Many thanks Angel ! Very interesting.
40s is twice is fast as the 15C version, which is consistent since the '41 is twice as fast as the 15C in general Smile

Just one question, I'm not familiar with 41Z, but do ZSTO/ZRCL work on complex registers ? So they need to be contiguous ? I'm intrigued because I see some ZSTO 03 and ZSTO 04 in your listing, how does it work ?

I don't think I deserve to have my name next to Valentin's and yours for this module Smile Kind of you, but I have done nothing much, just blind conversion !

Cheers
Find all posts by this user
Quote this message in a reply
04-22-2024, 09:48 AM (This post was last modified: 04-22-2024 09:52 AM by Ángel Martin.)
Post: #28
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
yes, the 41Z uses complex registers - which in turn are nothing more than pairs of contiguous real registers managed automatically by the STO/RCL/Z<>/VIEW/etc. functions.

You can peruse the HP-41Z Manual at your leisure if you're interested, it's available here

Cheers

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
04-22-2024, 09:51 AM
Post: #29
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
(04-22-2024 09:48 AM)Ángel Martin Wrote:  yes, the 41Z uses complex registers p which in turn are nothing more than pairs of contiguous real registers managed by the STO/RCL/Z<>/VIEW/etc. functions automatically.

You can peruse the HP-41Z Manual at your leisure if you're interested, it's available here

Cheers
Thanks !
I have no doubt that 41Z really shines. The problem is, it was not available in the 20th century, so you can't say that it beats the 15. Otherwise, Mathematica also does, but this is utterly unfair... Smile
There was a complex stack à la 15C developped in 1986 as part of the Toulouse "ROM". But this "ROM" was never more than an EPROM at the time, so I guess nobody could use it...

Cheers
Find all posts by this user
Quote this message in a reply
04-22-2024, 05:33 PM (This post was last modified: 04-22-2024 05:34 PM by Ángel Martin.)
Post: #30
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
Actually I beg to disagree with your Mathematica comparison: consider that the 41Z uses exclusively coconut MCODE and calls to the 41-OS, therefore it properly and fairly is the very same machine and thus should be considered part of the same achievement, no matter when it got "released" ;-)

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
04-22-2024, 05:35 PM
Post: #31
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
(04-22-2024 05:33 PM)Ángel Martin Wrote:  Actually I beg to disagree with your Mathematica comparison: consider that the 41Z uses exclusively coconut MCODE and calls to the 41-OS, therefore it properly and fairly is the very same machine and thus should be considered part of the same achievement ;-)
Yeah, I see your point Smile
41Z is what HP should have included in the advantage pack. If they could do something like that for the 15C in 1982, they should have been able to do it in 1985 for the '41!
Find all posts by this user
Quote this message in a reply
07-15-2024, 04:57 AM
Post: #32
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
(04-19-2024 05:43 AM)Thomas Klemm Wrote:  Using Help → Submit Issue (Web) allows to report it.
Or you can send Bill a message.

Done: 15C: CHS after EEX #116
Find all posts by this user
Quote this message in a reply
08-12-2024, 08:45 PM
Post: #33
RE: Valentin Albillo's "Boldly Going... Going Back to the roots" now for the...
(07-15-2024 04:57 AM)Thomas Klemm Wrote:  Done: 15C: CHS after EEX #116

Quote:Fixed and released in 2.1.15
Find all posts by this user
Quote this message in a reply
Post Reply 




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