# HP Forums

Full Version: 41C mCode routines
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

If anyone is interested in 41C mcode routines (besides Angel and myself) I have a some code to offer:

I have written a series of functions to implement recall math on the 41 something I always missed. Like code for multifunctions in the HEXPAC module you program a function and follow with a number in the next line designating the register. Example 12 RCL+ ,13 010 which means add the number in User Register 10 to the X-register without pushing the stack. The functions include direct: RCL+, RCL-, RCL*, RCL/ and indirect: RCLI+, RCLI-, RCLI*, RCLI/.
Also allowed is recall FROM a stack register and indirect FROM a stack register by using .00 to .05 to indicate registers T to L (the code limits stack/status register access to these register only for safety's sake).

Because a general purpose routine was developed to capture the next program line(s) other functions were able to be developed:
<> a register exchange function: 10 <>, 11 010, 12 001 for exchanging contents of User registers 10 and 1.
I<> exchange indirect the content of register given by the first register number with the contents of the second register.
I<>I exchange indirectly the content of User registers given by data in the given registers.

Once again by using .0n (where n=0-5) Stack/Status registers may be used.
One general limitation is that you CANNOT INDIRECT TO A STACK REGISTER; i.e., the indirect register can hold the number of a user register but not a .0n number to a stack register.

Also because a general capture routine was available a general multifunction routine was developed allowing for 1 to 999 subroutines to be called; i.e., 10 Multi1 11 001 calls subfunction 1. mCoders simply build a jump table to the subfunctions and set a guard byte to the size of the number of the subfunctions and compile the code.

There are limitations:
1) As stated the Indirection can only be from Stack registers not to them.
2) At the moment these functions are ONLY PROGRAMMABLE because the code acts on the following line(s).
3) After inserting these functions and before running the FOCAL program the user MUST PACK THE PROGRAM. (Technical: if nulls have been inserted between the function line and the line(s) of digits unforseen results will occur!)

1,2,and 3 will be addressed in future code as I get to it.

So, if anyone is interested in code for a discontinued,20+ year old calculator I'll be glad to publish it. You can comment here or email me. I have a general "test image" I use with emulators and if there's enough interest and if Warren allows maybe I can package up source and mod image and ship it off to him for posting on "that other site." Or if only a few want I can probably email the file(s) but this is slow as my day job is busy and tends to turn into a day and night job. (Plus I'm a single dad with a 12 yr. old son and those of you with kids know that at that age chasing after them is a full time job in itself)

DavidMY

Hi David, good to hear from you again.

As you stated, I'm interested for sure. I was wondering whether you've made enhancements to the image you sent me a few months ago. At that time you were still working on refinements to your RCL math routines, so I imagine there's improvements made now.

I'd like to add your code to a couple of functions in the 41Z project, for the STO and RCL of complex numbers, using two standard registers at a time. Could you send me the new code?

And as far as making it available, I'd say it is a great idea. The 41 archive site is perfect as repository for this type of works, so I'd encourage you to go ahead with it.

Best,
ÁM.

It is good to hear that there is still mcode being developed. And yes, please publish! Best way is to create a ROM and Warren will gladly put it on his website.

Meindert