HP67 to HP41 Program conversion


Hey there, can anyone give me some tips on converting 67 programs to 41 format? I recently tried to convert the Prime Factorization program in the software library over to 41. I haven't finished debugging the program but at the moment I can only get the program to output 0.0 for the prime factorization example. I haven't done trace yet or anything like that. I'm not too familiar with programming the 41 as the last programming I did was for an 11C. Any hints or tips would be greatly appreciated. BTW, I have the card reader owner's manual and used that to adapt the program. I'm thinking I'll need to alter which registers are used to store the working numbers. Or else I could just buy a 67 or 97. Thanks, Randy


The easiest way is to store the program on a card and then read it into an HP41 using its card reader. This will do most of the conversion for you, with special functions in the card reader taking the place of functions in the 67/97 that are not available on the HP41.

The 67 has rapid reverse branching doesn't it??? That's one thing that the HP41 can't do, and you'd need to change the program logic to make it work.


I had to convert some things from the hard copy of the program to enter it into my 41. STO B on a 67 becomes STO 21 on a 41. So saving it on a card only saves what I have already put into my calculator. I don't have the 67 program cards for this program. I did run a trace and am now going through that to see what I can find out. Thanks for the response. Randy


I am not familiar with the routine you are trying to convert. But here are a couple of suggestions:

1 - Make sure that the program does not use Rapid Reverse Branching

2 - Use register 25 as the i register (that's what the card reader does and you will be consistent if you need to convert any other programs over.

3 - Does the program use P S? This command excahnges the primary registers (0-9) with the secondary registers and allows those to be addressed. You can only address registers 0-9 directly. Can't remeber whether indriect address gives you access. At any rate, if this function is being used and you have a card reader then simply use 7P S which is a built in card reader command. If you have a CX or an extended functions module you can fake this command by using REGSWAP. Otherwise you will either have to write a routine to fake it or you will have to go through the process of tracking all registers and manually changing the code to address 10-19 after P S has been executed in the listing.

4 - Remember that the 67 uses DSZ and ISZ not DSE and ISG as with the HP41.

5 - (i) is the same as RCL IND 25 (if you use 25 as the i register.

6 - The 67 uses DSP function that sets the display precision. The 41 uses FIX/SCI/ENG followed by a number.

I believe that for the most part everything else works the same way on both machines. There may be a few gotchas that I am missing, I am sure someone will jump in and help if that is the case.

If you do have the card reader what I would do is simply type it in as listed using the card reader emulation functions which have the same names as the 67 functions except that they are preceeded by a '7' (as in 7P S). The DSP functions are slightly different. There are 10 of these (??) and they are named 7DSP0 - 7DSP9. Once you have the thing working you can slowly convert over to be 100% HP41 compliant.

Hope this helps,

Marwan Joury


Thanks for the tips. I think most of the problems are with condition checks being wrong. The program is the Factors and Primes program in the 67 software library here on the site. There are none of the things you talked about in the program at all. I wondered about that and read the 67 programming document here on the site. I think my biggest problem is lack of programming experience. Thanks again for the tips. Randy



I looked at the program (simple visual inspection -- did not try to key it in) it looks pretty straight forward. No tricks as far as I can see. There are several places where you can take advantage of the HP41's more advanced instruction set. As an example the Lbl E routine which is supposed to switch flag 0 between a set and unset state and let the user know by dislaying either a 1 or a 0 can be shortened to the following on the 41:

Lbl E FC?C 00 SF 00 RTN

The first instruction (flag clear? and clear) test to see if flag 0 is clear and followes the rule "skip if false". Either way the flag is cleared. Thus if the flag is already clear the flag is cleared (no effect) and the next instruction is executed which sets the flag, otherwise, if the flag is set the flag is cleared and the next instruction is skipped causing a toggle effect. You ndon't need to display 0 or 1 on the 41 since the flag is visible on the display.

However, the current code should work just fine and all of it looks like it should run with minimal modifications (mainly register mapping).



Thank you for the help. I was finally able to get the program running. I left out a line of code in the output routine. Once I added that, it worked just fine. One of these days, I will be able to program my 41C! Again, thanks for the help. Randy

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP67 eBay auction Cristian Arezzini 3 734 12-08-2013, 03:47 PM
Last Post: Raymond Del Tondo
  HP 35s polar/rectangular conversion CD Dodds 6 841 11-28-2013, 02:39 PM
Last Post: Dieter
  HP67/97 M.E. Pac cover Ignacio Sánchez 2 530 11-22-2013, 04:04 AM
Last Post: Ignacio Sánchez Reig
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 854 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  [WP 34s] Pressure Conversion Factors Timothy Roche 8 1,083 11-04-2013, 07:17 PM
Last Post: Dave Shaffer (Arizona)
  More programs for polar-rectangular conversion on HP Prime Michael de Estrada 4 752 11-04-2013, 12:43 AM
Last Post: Michael de Estrada
  HP Prime: Conversion factors Paul Townsend (UK) 19 1,622 08-27-2013, 09:19 AM
Last Post: Nigel J Dowrick
  [hp41] reading the catalog under program control Wolfgang 3 573 02-25-2013, 01:32 PM
Last Post: Dan Grelinger
  HP41 Blank formulars for program documentation? Wolfgang 3 531 02-15-2013, 11:08 PM
Last Post: Wolfgang
  WP34S conversion, yet another but with a difference Geoff Quickfall 23 1,922 06-22-2012, 02:54 PM
Last Post: Marcus von Cube, Germany

Forum Jump: