(41CX) Recall Stat Regs By Name
03-04-2016, 02:03 PM (This post was last modified: 03-05-2016 06:03 PM by Dave Britten.)
Post: #1
 Dave Britten Senior Member Posts: 933 Joined: Dec 2013
(41CX) Recall Stat Regs By Name
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.
03-05-2016, 08:46 PM
Post: #2
 Dieter Senior Member Posts: 2,133 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
(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
03-05-2016, 09:23 PM
Post: #3
 Werner Senior Member Posts: 318 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
The PPC ROM contains one..
and that's usually as good as it gets..
03-05-2016, 10:28 PM
Post: #4
 Dieter Senior Member Posts: 2,133 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
(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
03-06-2016, 12:34 AM
Post: #5
 rprosperi Senior Member Posts: 2,836 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
(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.

--Bob Prosperi
03-06-2016, 01:45 PM (This post was last modified: 03-06-2016 02:03 PM by Dieter.)
Post: #6
 Dieter Senior Member Posts: 2,133 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
(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
03-06-2016, 02:41 PM
Post: #7
 Sylvain Cote Senior Member Posts: 887 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
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.
03-06-2016, 07:55 PM (This post was last modified: 03-06-2016 07:55 PM by Dieter.)
Post: #8
 Dieter Senior Member Posts: 2,133 Joined: Dec 2013
RE: (41CX) Recall Stat Regs By Name
(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
 « Next Oldest | Next Newest »

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