Post Reply 
Local registers on HP-41?
09-23-2016, 01:09 PM
Post: #1
Local registers on HP-41?
At HHC-2016 Gene gave an update on the HP-41CL. He also mentioned the NoVRAM alternative.

One thing that they both seem to have in common is a lot of available registers. I've often thought that *people* don't need extra registers, but *programs* do.

The WP-34S has the concept of Local Registers and flags (see "Local Data" beginning on page 69 of Edition 3.1 of the WP-34S Owner's Manual). In summary, a subroutine can allocate n local registers by executing LOCR n. Thereafter the registers are available and registers .00, .01, etc. If a new subroutine calls LOCR, then it allocates a different set of local registers. When a subroutine executes RTN, the local registers are deallocated.

So here is my question/challenge: would it be possible to add local registers to the 41C? I imagine that no opcodes are available, so the STO/RCL functions would have to be individual library functions (XROM calls? It's been a while...). The memory for the registers would be allocated in bigabytes of memory on some of these cards.
Find all posts by this user
Quote this message in a reply
09-23-2016, 11:35 PM
Post: #2
RE: Local registers on HP-41?
You could use data files in X-Memory as local register blocks, and/or swap in/out main memory register blocks and X-Memory register blocks. So if your program needs 10 memory registers for local storage, first save the register contents of those regs to an X-M file, then use them locally within your program, and restore the block afterwards. Given an X-F module is plugged, of course;-)

-- Ray
Find all posts by this user
Quote this message in a reply
09-24-2016, 02:17 AM (This post was last modified: 09-24-2016 02:21 AM by Geoff Quickfall.)
Post: #3
RE: Local registers on HP-41?
That's what I do Raymond.

X MEM retains constants in data bases that are accessed by multiple programs. I have program which stores the time at the start of the program in X MEM as a reference for whenever the progrM is called. This allows for the use of the normal (lower) registers by multiple programs without changing the required register.

It would be nice to have a much larger set of X MEM registers in X MEM to provide a larger more useful database greater then the 640 allotted. Remember X MEM is also used for program storage use so data bases take up much memory.

I have a lot of CL catch up to do but mabey there are bigabytes :-) in flash and CL commands that can access them.

Geoff
Find all posts by this user
Quote this message in a reply
09-24-2016, 05:07 AM
Post: #4
RE: Local registers on HP-41?
This is a good idea and something I may want to put in a future module, though I have some ideas to do it a bit differently.

There are basically two options I would consider on where to take the memory needed from, the free area or extended memory.

The free area has the advantage of working on all models, but the amount of (free) memory available can be a limiting factor.

Extended memory works on CX and CL models, where the entry points for working with extended memory are fixed. On the C/CV it would require an extended functions module, which can be put into any port and making the code work with extended memory on both variants is not so appealing to me.

Is it worth supporting the HP-41C and HP-41CV models? Do you tend to fill the main memory on your HP-41?

Håkan
Find all posts by this user
Quote this message in a reply
09-24-2016, 09:22 AM
Post: #5
RE: Local registers on HP-41?
A similar concept to these local registers is already implemented in the Total_Rekall module. There it is called the "shadow stack or emergency buffer" and provides 5 data registers for data storage and recall. Dedicated prompting functions are bRCL, bSTO, bX<>, and bVIEW with allowed values from 1 to 5.

This buffer is also used for other purposes, like stack shuffle-selective delete, and subroutine RTN stack extension....
Find all posts by this user
Quote this message in a reply
Post Reply 




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