|Re: hp41 programming questions|
Message #2 Posted by Vieira, Luiz C. (Brazil) on 25 Apr 2004, 12:06 p.m.,
in response to message #1 by fulcrum
Tha HP41 main memory has some "concepts" that sometimes must be well known so you can use it completely.
As you are using X-functions, the possibilities are even bigger, and main memory organization is now under X-functions "extra" possibilities as well.
There is always one "last program in memory" since you turn an HP41 for the first time or after performing any operation that causes [MEMORY LOST ] condition. As you may know, the HP41 has 320 registers of RAM available for the user; in fact, three bytes are already holding the permanent .END., so you can only convert 319 of these 320 registers into numbered registers by using SIZE nnn; right?
This "last program in memory" will also contain all instructions of the actual last program; this program is the one without the END as its last step. If you execute CAT 1 and follow the last entries, you'll see that you may have both cases:
- last global label, [nnn END ] and [.END. REG mmm]
- last global label and [.END. REG mmm]
If you note the second case, then you can press [SHIFT][GTO][.][.] that an END will be added to the set of instructions that actualy compose the "last program in memory". Now you have all eisiting programs with their own END and, again, a permanent .END. with all remaining memory available for the next program.
When you execute [GETSUB], this whole process of adding an END to the existing last program in memory is performed so it is kept for future use, then the new program (from X-memory) is now the last program in memory;
If you execute [GETP] instead, the last program in memory is deleted prior to loading the new one from X-memory.
About deleting programs from a running program: you should CAREFULLY use [PCLPS] (Programmable CLear ProgramS], that clears the current running program AND ALL SUBSEQUENT PROGRAMS IN MEMORY if ALPHA is empty, or clears the program that contains an ALPHA label that matches ALPHA contents AND ALL SUBSEQUENT PROGRAMS AFTER THIS PROGRAM in main memory. If ALHPA contains an ALPHA string without a matching global label in main memory, [PCLPS] will not clear any program and [NAME ERR ] message is shown. [PCLPS] is available with X-functions ROM module and can be executed directly from the keyboard as well. As everything except X-register contents in an HP41, all information lost with [PCLPS] cannot be recovered, i.e., [PCLPS] cannot be undone, so use it carefully. If you execute [CAT] 1, stop it at the very first entry, clears ALPHA contents and execute [PCLPS], all programs in memory are wipped out definitely.
And there isa way to run programs in X-memory without the need of loading thaem in main memory first, but I am not so sure about how to do it. Many wizards in here have this knowledge...
Hope this gives you a brief start.
Edited: 25 Apr 2004, 12:21 p.m.