HP Forums
hp41 programming questions - 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: hp41 programming questions (/thread-55847.html)



hp41 programming questions - Fulcrum - 04-25-2004

Hello,
The first question is that when I am executing a program I have a subroutine program stored in xmemory so I recall it with the getsub command to free the main memory, but after it is used, I want to delete it from main memory from the main program itself, but I cant because the function clp says nonexistant (as the subroutine is yet only in extended memory and not still copied in the main memory) and can't register that clp function in the main program. Can this be done in another way?
the other is if is there any way to run programs directly from extended memory i mean unofficially or something
Thank you very much for you wise answers and help


Re: hp41 programming questions - Vieira, Luiz C. (Brazil) - 04-25-2004

Hi, 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]

or

- 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.

Cheers.

Luiz (Brazil)

Edited: 25 Apr 2004, 12:21 p.m.


Re: hp41 programming questions - Miki Mihajlovic - 04-25-2004

Luiz has given a comprehensive explanation to your first question and there is little to add to it. To answer the second question, yes there is a very simple program "EXM" that allows programs to be run directly from Xmemory. It is given on page 191 of Keith Jarett's book "Extended Functions Made Easy", that I would recommend if you are using Xmemory extensively. However, there is one severe limitation - the program you are about to execute from Xmemory must completely reside in Xfunction/memory module, it can not spill over into another Xmemory module. Here is the listing:

LBL "EXM"
190
CLA
XTOA
RDN
ASTO b
END
So, the program in Xfun/mem module can't be bigger than 127 registers, must be the first program in Xmemory and you just XEQ "EXM". You can still execute the second etc. program in Xmemory if you know the absolute address of the second etc. header register of the program you want to execute. Use that number instead of 190 (line 2).

1234


Edited: 25 Apr 2004, 5:02 p.m. after one or more responses were posted


Re: hp41 programming questions - Fulcrum - 04-25-2004

Thank you Luiz and Mike
Can you tell me how to insert the asto b command?
Thank you


Re: hp41 programming questions - Virgilio Guillen - 04-25-2004

Hi,

To learn how to type ASTO b and other useful instructions
read the Synthetic Programming section on the museum.

http://www.hpmuseum.org/prog/synth41.htm




Re: hp41 programming questions - Miki Mihajlovic - 04-25-2004

To give you a quick heads up the sequence to create ASTO b after you have the Byte Grabber is:

ENTER
STO IND 26
MEAN

Of coures, it is all much simpler if you have Zenrom, CCD Rom or even better - Clonix.

1234

Edited: 25 Apr 2004, 6:35 p.m.