HP Forums
HP41cx Programming Question - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP41cx Programming Question (/thread-3237.html)



HP41cx Programming Question - Dale Rees - 01-12-2000

I am trying to re-enter a program which I lost when my battery died in my HP41CX fortunately I had a program dump (but I have never coded before)... A couple of things I am stuck on

1: is the key sequence to input FS?C 02 XEQ ALPHA FS?C 02 ALPHA

2: is the key seq to input TONE 1 XEQ ALPHA TONE 01 ALPHA

3: I have re-entered 27 programs into cat 1 comprising 1418 bytes and still have 14 programs (888 bytes) to go when I got a TRY AGAIN message. I executed PACK and got the message 10.0000 I executed SIZE? and got the message 100.0000 If I put the calculator into program mode I get the message .END. REG 00 Now the only reason that I can think of why I ran out of room is that do to my inexperience I performed the GOTO.. at the end of each program BUT I didn't see the documentation that you should put a GOTO.. at the start of each program....have I wasted alot of memory? can I fix this?

4: on my original hard copy dump I have 41 progams listed with their bytes under cat 1 . THEN I have a cat 4 listing with 9 listings of some of the program names appearing in cat 1 , however there is a strange number after the name (P026, P016,P012, P014,P010 and P022) with a number at the bottom appearing like a total - 196.000 I am wondering if these programs were pushed into extended memory to make more room? I don't know how to do this

Thanks in advance for any help Dale




Re: HP41cx Programming Question - Valtoni - 01-12-2000

1) The sequence is: XEQ ALPHA FS?C ALPHA 02 2) The sequence is: XEQ ALPHA TONE ALPHA 1 3) Try reducing the SIZE. This will let you with less data registers but with more program space. Try, for instance, SIZE 010. You'll get .END. REG 90 in program mode. GTO.. puts an END at the end of your current program only if it still hasn't one. So you'll not lose space with extra GTO.. 4) Cat 4 shows the contents of your extended memory. To copy a program to extended memory use SAVEP (put the name of the program in Alpha register, then XEQ SAVEP).

Hope this helps!


Re: HP41cx Programming Question - Wayne Brown - 01-12-2000

1. The correct sequence is XEQ ALPHA FS?C ALPHA and it will prompt you with FS?C _ _ when it is time to enter the 02

2. Likewise, it's XEQ ALPHA TONE ALPHA then wait for TONE _ prompt and enter 1

3. Your calculator has a total of 319 registers of main memory (not counting extended memory, of course). Main memory is used for both data and program storage. When the calculator is reset to it's power-on defaults (when a MEMORY LOST occurs) it allocates 273 registers to data and 46 to program storage. This can be changed with the SIZE command, though. Your use of the SIZE? command shows that there are 100 registers allocated to data, which means you have 219 for programs. The REG 00 in program mode shows that all the program registers are full. Depending on how many data registers you need, you can switch some of them to program storage. For instance, if you do XEQ ALPHA SIZE ALPHA and answer the SIZE _ _ _ prompt with 020 then you'll get another 80 registers for programs and you'll see REG 80 in program mode.

All the GTO .. does is to add an END to the last program in memory (if there isn't one already) and then PACK memory by removing null bytes. (Registers are 7 bytes each, and when you edit and delete programs you can end up with some of the bytes between lines empty, so that a program that would fit in a few registers might be taking up more than it needs. GTO .. shoves all the code together so that the empty bytes are at the end and can be released. The PACK command does the same thing, but doesn't add an END statement or move the program counter like GTO .. does.) It works the same way whether you enter it before or after keying in your program, so you don't have to worry about any memory being wasted because you didn't do it at the start of the program. The reason for doing it at the start is because if you don't insert an END statement after each program yourself, then each program you key in will be tacked on to the end of the previous one and you'll end up with one long program. It's even worse if you load programs from magnetic cards or tapes or diskettes. If the last program in memory doesn't have an END, then it will be erased and replaced by the program loaded from the external storage device. So it's a good idea to always do GTO .. before loading a program to be sure it works the way you expect.

4. The numbers such as P026 in your CAT 4 listing indicate the file type and size. In this case it's a (P)rogram file and it takes up 26 registers. These programs are indeed in extended memory, though they can't be executed (without synthetic programming techniques) unless they are first copied back into main memory. It's possible that some of your other programs copy them to main memory when needed and then delete them when they're through. You can use the SAVEP command to copy a program to extended memory and the GETP command to copy it back to main memory. For example, if you have a program called PRG1 then you could put it in extended memory like this:

a. Key the program into main memory.

b. Put it's name in the alpha register: ALPHA PRG1 ALPHA

c. Copy it to extended memory: XEQ ALPHA SAVEP ALPHA

d. If you want to delete it from main memory: XEQ ALPHA CLP ALPHA and respond to the prompt with ALPHA PRG1 ALPHA

e. To copy it back to main memory: XEQ ALPHA GETP ALPHA

f. If you want to delete it from extended memory: XEQ ALPHA PURFL ALPHA

Be sure when you use any of these extended memory program commands that the name of the program is in the alpha register.


Re: HP41cx Programming Question - Chris Catotti - 01-13-2000

When the calculator [HP-41CV or the HP-41C with four memory modules, or one quad memory module] is reset to it's power-on defaults (when a MEMORY LOST occurs) it allocates 273 registers to data and 46 to program storage. When the calculator [HP-41CX] is reset to it's power-on defaults (when a MEMORY LOST occurs) it allocates 100 registers to data and 219 to program storage.


Re: HP41cx Programming Question - dale-thanks - 01-13-2000

thanks everybody, you got me through it and my old program set is finally working again!! Dale


Re: HP41cx Programming Question - Wayne Brown - 01-13-2000

Thanks for the correction, Chris. I was going by the behavior of my HP-41CV and didn't realize the initial allocation was different on a 41CX.