The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(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
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


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



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