Post Reply 
Swapping Registers on HP calculators
03-28-2024, 12:49 PM (This post was last modified: 03-28-2024 01:28 PM by n1msr.)
Post: #8
RE: Swapping Registers on HP calculators
Didier,

Thank you.

After looking at other parts of my program (not shared) I agree that using the registers R0 and R1 is better.

I just found the manual page for the 15c that confirms that "f USER" is not a programmable function :-(
(I would have liked USER mode ON to initialise the arrays, where the R1 value is automatically incremented.
However, I would prefer that R1 is NOT auto-incremented in other areas of the program such as the SWAP and two subroutines that I have not shared, where I need to increment and decrement an element of the B matrix.)

A possible 'quirk' of the HP15? If I want to add an element of matrix A to the number on the stack (X) in a program, it seems that I have to have a NOP (or duplicate the key operation) to get it to work. I think this is a "feature" of the 15c because I came across a duplicate operation like this in one of the forum threads on the 15c with matrix operations in a program. I have lost the post so cannot provide a link, sorry.

Here is my listing to display the entire matrix A (1,9) in the X register for display of a permutation.
My listing does not show the "u" for the matrix operations RCL A, which the 15c does.
(USER mode is ON)

Code:

f LBL E
f MATRIX 1 \\initialise matrix indices to 1 (R0 & R1)
8.00001     \\number all on one line here for brevity
STO I
0                \\ 0 on stack ready for arithmetic
f LBL 9
RCL I
g INT
10^X          \\ use the I register with 10^X to position the ith digit in X
RCL A          \\ get ith element of matrix A
x
+
f DSE I        \\ decrement I
GTO 9         \\ loop until I is zero        
RCL A          \\ i is zero is final element (1,9)
+                \\ this is a NOP in effect.  The calculator does not run it after the RCL A operation
+                \\ this + is executed by the calculator
R/S
g RTN




Regards,

Mark.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Swapping Registers on HP calculators - n1msr - 03-28-2024 12:49 PM



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