Post Reply 
Porting HP48 Program to HP50g
02-27-2017, 03:20 AM
Post: #1
Porting HP48 Program to HP50g
I'm sure stuff like this gets posted all the time. I spent 4 hours on a Sunday on this, searching the forums and trying this from different angles, and now it's time to ask for help.

I was attempting to get the program "Linalg" http://www.hpcalc.org/details/5057 to work on my HP50g, and thought I had it before everything crashed.

I transferred the source code file to the 50g with an SD card, put the string in the stack, and ran ObjFix v11 to compile it (is this what is happening here?). The ASM command in development tools wasn't having it, so that could be the first red flag.

After running ObjFix It showed up in the menu, so I entered a matrix and tried to execute a command and next thing you know I was taking out the batteries.

This program seems amazingly useful, it would be great to see it run on the 50g some day. Any help will be appreciated.

Thank you,

Quinn
Find all posts by this user
Quote this message in a reply
02-27-2017, 07:24 AM (This post was last modified: 02-27-2017 07:28 AM by Joe Horn.)
Post: #2
RE: Porting HP48 Program to HP50g
Quote:I transferred the source code file to the 50g with an SD card, put the string in the stack, and ran ObjFix v11 to compile it (is this what is happening here?).

Yes, that's right. The file called "linalg420src" is an HP 48 directory object stored in binary form. So when you imported it to the 50g, it arrived as a string with extraneous header bytes which ObjFix removed, returning it to its proper form as a directory object. That should be stored in a variable, e.g. linalg420.

Unfortunately, turning that source code into a working library would be almost impossible, because that source code was written in HP 48 Jazz notation using the HP 48 System RPL command set. To translate it into 50g System RPL, *many* things need to be changed (e.g. the HP48's System RPL command MATTRN needs to be changed to FPTR2 ^MATTRN for the HP 50g), and many commands have no 50g equivalent at all (e.g. I noticed QRMOD in the 48 source code, but QRMOD doesn't exist in the 50g command set, and would either need to be replaced by some other command with equivalent functionality -- if such exists -- or rewritten entirely).

In other words, there's no easy way to port that library to the 50g. It would be a large undertaking. Sorry.

Obvious suggestion: Ask the author (Scott Hyde) whether he ever rewrote it for the 50g himself.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
02-27-2017, 12:44 PM (This post was last modified: 02-27-2017 12:51 PM by Han.)
Post: #3
RE: Porting HP48 Program to HP50g
(02-27-2017 07:24 AM)Joe Horn Wrote:  Unfortunately, turning that source code into a working library would be almost impossible, because that source code was written in HP 48 Jazz notation using the HP 48 System RPL command set.

Jazz has been ported to the HP50G, so you could try to compile yourself and see where it leads.

http://www.hpcalc.org/details/7196

Place the MAKE420 string onto the stack, and assemble it (or try to); if you run into errors, you might try posting here to see if anyone can help.

Quote:To translate it into 50g System RPL, *many* things need to be changed (e.g. the HP48's System RPL command MATTRN needs to be changed to FPTR2 ^MATTRN for the HP 50g), and many commands have no 50g equivalent at all (e.g. I noticed QRMOD in the 48 source code, but QRMOD doesn't exist in the 50g command set, and would either need to be replaced by some other command with equivalent functionality -- if such exists -- or rewritten entirely).

If Jazz runs into commands that it does not recognize, it will give you an error and an error location, which you can then immediately use with the editor to find the command. If you then do a search for the command (see the Jazz documentation), you might find its equivalent in the entry catalogue -- which will tell you what type of command it is. For example, if MATTRN produces an error, searching for MATTRN should reveal the entry as being FPTR2 type.

QRMOD is one of the commands that gets created by the library. If there are commands that do not have an HP50G translation, Jazz will help you find them pretty quickly.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
02-27-2017, 03:52 PM (This post was last modified: 02-27-2017 04:26 PM by Han.)
Post: #4
RE: Porting HP48 Program to HP50g
I managed to compile by doing the following:

1. Install Jazz on EMU48 for both the 48G and 50G emulators.
2. On the HP48 emulator, go into the source directory.
Code:

VARS DUP SIZE 1 SWAP
FOR N 
  DUP N GET EVAL SWAP
NEXT
DROP
3. Press up key and go to the top of the stack, and select ->LIST from the menu.
4. Type DIS (Jazz command), and then use the emulator's copy stack command.
5. Paste into the HP50 emulator.
6. On the HP50 emulator, use ASS to compile the string back to a list.
7. On the HP48 emulator, type VARS DIS to decompile the list of variables.
8. Copy this string from the HP48 emulator into the HP50 emulator, and then compile using ASS. You should now have a list of strings on level 2, and a list of variables on level 1.
9. On the HP50 emulator, type 'LA' CRDIR and enter the LA directory you just created.
10. Then press the STO key on the HP50 emulator
11. On the HP50 emulator, type VARS REVLIST ORDER (this reorders the variables) to their original order.
12. In the variable MAKE420, simply add the following lines to the top of the string object

Code:
DEFINE MATTRN FPTR2 ^MATTRN
DEFINE DIMLIMITS FPTR2 ^DIMLIMITS
DEFINE MATCON FPTR2 ^MATCON
DEFINE MAKEARRY FPTR2 ^MAKEARRY
DEFINE XEQ>ARRAY FPTR2 ^XEQ>ARRY
DEFINE MATREDIM FPTR2 ^MATREDIM
DEFINE MDIMS FPTR2 ^MDIMS
DEFINE #1-+ #+-1

13. Place the edited MAKE420 string onto the stack, and type ASS. This will compile the library.

I did not bother to check if any of the code works -- I merely wanted to see if it would compile, and it seems to compile fine. One should check whether the substitutions above are correct.

By the way, I found a minor bug in Jazz through this process so I guess I need to dig the project back up!

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
02-27-2017, 06:17 PM
Post: #5
RE: Porting HP48 Program to HP50g
(02-27-2017 03:52 PM)Han Wrote:  I managed to compile by doing the following:

By the way, I found a minor bug in Jazz through this process so I guess I need to dig the project back up!
Han, Thanks for your thorough response. I feel slightly honored to help you find a bug in Jazz; I noticed on the Jazz webpage that only 1 bug had previously existed.. Tongue

I'll take a stab at this next weekend. Thanks to everyone that responded. I'll report back with results, and I'll make an attempt to test all (most) of the program's commands.

Quinn
Find all posts by this user
Quote this message in a reply
02-28-2017, 01:07 AM
Post: #6
RE: Porting HP48 Program to HP50g
Updated Jazz for the HP50G to fix an issue with error messages from INCLUDE'd source files.

Jazz 50G v1.255

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: