|Re: HP41cx Programming Question|
Message #3 Posted by Wayne Brown on 12 Jan 2000, 9:09 p.m.,
in response to message #1 by Dale Rees
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.