HP Forums
(41CX) Recall Stat Regs By Name - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP-41C Software Library (/forum-11.html)
+--- Thread: (41CX) Recall Stat Regs By Name (/thread-5815.html)



(41CX) Recall Stat Regs By Name - Dave Britten - 03-04-2016 02:03 PM

Here's a really simple program for recalling the stat registers by name, independent of the currently defined ΣREGS. This requires the ΣREG? function present on the 41CX. To use, simply XEQ any of these labels:

ΣX
ΣX^2
ΣY
ΣY^2
ΣXY
ΣN

This program is notable in that it requires no storage registers, and only a single stack level, so it's as unintrusive as simply recalling the register directly*. There's a slight efficiency penalty to make this possible, so it's not really suitable for use in tight loops.

Code:
01 LBL "ΣX"
02 ΣREG?
03 GTO 00
04 LBL "ΣX^2"
05 ΣREG?
06 GTO 01
07 LBL "ΣY"
08 ΣREG?
09 GTO 02
10 LBL "ΣY^2"
11 ΣREG?
12 GTO 03
13 LBL "ΣXY"
14 ΣREG?
15 GTO 04
16 LBL "ΣN"
17 ΣREG?
18 ISG X
19 LBL 04
20 ISG X
21 LBL 03
22 ISG X
23 LBL 02
24 ISG X
25 LBL 01
26 ISG X
27 LBL 00
28 RDN
29 RCL IND T
30 RTN
31 END

*Note that running this program enables stack lift, so whereas "CLX, RCL 11" would leave Y, Z, and T as-is, "CLX, XEQ ΣX" will lift X and discard T.

EDIT: Saved a few bytes.

EDIT Again: Saved a couple more bytes.


RE: (41CX) Recall Stat Regs By Name - Dieter - 03-05-2016 08:46 PM

(03-04-2016 02:03 PM)Dave Britten Wrote:  Here's a really simple program for recalling the stat registers by name, independent of the currently defined ΣREGS. This requires the ΣREG? function present on the 41CX.

Yes, it does. I always wondered why the X-Functions module featured the missing SIZE? command, while OTOH there was no ΣREG?.
Which leads to the question of an optimized, short and effective synthetic routine that does this job on a 41C/CV.
Any suggestions?

Dieter


RE: (41CX) Recall Stat Regs By Name - Werner - 03-05-2016 09:23 PM

The PPC ROM contains one..
and that's usually as good as it gets..


RE: (41CX) Recall Stat Regs By Name - Dieter - 03-05-2016 10:28 PM

(03-05-2016 09:23 PM)Werner Wrote:  The PPC ROM contains one..
and that's usually as good as it gets..

That's what I remember as well.
But do you have a source for this?

Dieter


RE: (41CX) Recall Stat Regs By Name - rprosperi - 03-06-2016 12:34 AM

(03-05-2016 10:28 PM)Dieter Wrote:  
(03-05-2016 09:23 PM)Werner Wrote:  The PPC ROM contains one..
and that's usually as good as it gets..

That's what I remember as well.
But do you have a source for this?

Dieter

By "source", if you mean author, the PPC ROM manual would reveal that. If OTOH you meant source code, you can see that in both the manual and the ROM itself. I think the manuals are part of the MoHPC USB drive, so you likely have it already, but holler if you need this portion of the manual.


RE: (41CX) Recall Stat Regs By Name - Dieter - 03-06-2016 01:45 PM

(03-06-2016 12:34 AM)rprosperi Wrote:  By "source", if you mean author, the PPC ROM manual would reveal that. If OTOH you meant source code, you can see that in both the manual and the ROM itself.

Actually I was looking for a source of the source code. ;-)
Sorry, this must have been really bad English, maybe because in German there is a certain overlap in the meanings of "source" and "reference"... #-)

(03-06-2016 12:34 AM)rprosperi Wrote:  I think the manuals are part of the MoHPC USB drive, so you likely have it already, but holler if you need this portion of the manual.

YES, THAT'S WHAT I AM LOOKING FOR. ;-) I was sure I got this routine somewhere but I simply could't find it.
But wait... I got a PDF of this book by J.S. Dearing with useful HP41 routines. Et voilà: here it is. A 40-step routine where the PPC ROM is mentioned in the credits.

But nevertheless maybe you can post what you got? Just for comparison. ;-)

Dieter


RE: (41CX) Recall Stat Regs By Name - Sylvain Cote - 03-06-2016 02:41 PM

Sigma Registers Finder

-> PPC ROM Manual P462-463
-> Calculators Tips & Routines P73 (19-4)

The PPC rom routine is shorter but requires other routines from the ROM
while CT&R does the same and is autonomous.


RE: (41CX) Recall Stat Regs By Name - Dieter - 03-06-2016 07:55 PM

(03-06-2016 02:41 PM)Sylvain Cote Wrote:  Sigma Registers Finder

-> PPC ROM Manual P462-463
-> Calculators Tips & Routines P73 (19-4)

The PPC rom routine is shorter but requires other routines from the ROM
while CT&R does the same and is autonomous.

Obviously the latter is what I got here: a German version of this "CT&R" book.
At least here "Σ?" is routine #19-4 as well.

Dieter