hp41 programming questions


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


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]


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


Luiz (Brazil)

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


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:

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


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


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



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



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


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


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

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime questions: I/O and Meta programming Andy Gryc 2 636 10-31-2013, 11:22 PM
Last Post: Andy Gryc
  Custom Programming vs. Pre-packaged programming Eddie Shore 3 617 01-24-2005, 03:42 AM
Last Post: Karl Schneider
  HP41 Programming challange Harry (Germany) 22 2,044 07-28-2003, 04:50 PM
Last Post: Harry
  Two questions on 41cx programming Sean McNamee 4 537 07-19-2003, 04:11 PM
Last Post: Sean McNamee
  a few HP41 Questions Christof 13 1,434 04-30-2003, 03:46 AM
Last Post: Christoph Klug
  Questions about Programming Ben Salinas 5 682 04-02-2003, 03:19 PM
Last Post: Dave Shaffer
  HP41 programming. Howard 4 621 02-04-2003, 09:28 AM
Last Post: Johnny Billquist
  RPN/RPL and the HP41 Programming Language Vieira, Luiz C. (Brazil) 3 543 11-10-2001, 02:56 PM
Last Post: Andrés C. Rodríguez (Argentina)

Forum Jump: