Post Reply 
Adding/Editing Programs for the HP50G
08-28-2020, 02:18 AM
Post: #1
Adding/Editing Programs for the HP50G
I'm in the process of migrating from the 48GX to the 50G, or at least trying to get my little programs moved over. What I realize I've done is I used the connectivity kit to transfer the directories and CST out of my 48GX to my PC, which is done in ASCII. When I open them with a text editor, this is what I see (for example, an incomplete copy of a directory, top level of which is "CHE"):

Code:
%%HP: T(1)A(D)F(.);
DIR
  EQ1 'Q/A=hc*(Tw-T
)+˜*“*(Tw^4-T^4)'
  A '5.65895372234_
ft^2'
  Q '90000_Btu/h'
  U '112_Btu/(ft^2*
h*°F)'
  dT '142_°F'
  EQ { EQ1 HTX }
  HTX 'Q=U*A*dT'
  THERMO
    DIR
      EQULB
        DIR
          EQ '
1.06084841536E-2=4*

(Forgive the formatting, that's just how it comes out.)

When I copy it to the SD card and then insert the SD card into my 50G and then transfer it over to the HOME directory, what I transferred comes out as a string. Not a directory with subdirectories, equations, programs, etc. as it was on the 48GX.

So here are my questions:

  1. Obviously I have to transfer these things from the 48GX in binary for them to work correctly in the 50G, right?
  2. I'd like to be able to edit these things on my computer. How can I transfer over, edit them, and then transfer them back?

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-28-2020, 02:45 AM
Post: #2
RE: Adding/Editing Programs for the HP50G
I think the answer to this is I have to learn how to use Debug4x. I've installed it, trying to wrap my head around it.

I tried to delete my original post but I don't have permission to do that soooo... If I'm wrong, someone let me know. Thanks!

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-28-2020, 04:32 AM
Post: #3
RE: Adding/Editing Programs for the HP50G
(08-28-2020 02:18 AM)MattGreer Wrote:  When I copy it to the SD card and then insert the SD card into my 50G and then transfer it over to the HOME directory, what I transferred comes out as a string.

Suggestion: Recall the string to level 1 on your 50g. Edit out the first line (the header which begins with %%). Then press left-shift down-cursor (or TOOL, then shift EDIT) which puts the string and its double quotes into the edit line. Then remove the opening and closing double quotes and press ENTER. That will force the 50g to parse it exactly as if you had just typed the entire thing manually into the 50g's edit line. If a syntax error occurs, fix it (the error will be near where the cursor is blinking) and try again. This should work.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-28-2020, 05:34 AM (This post was last modified: 08-28-2020 05:34 AM by Gerald H.)
Post: #4
RE: Adding/Editing Programs for the HP50G
Remove header line as in posting #3 then open PRG menu & actuate OBJ-> , you should now have the string transformed into the underlying object on stack level 1.
Find all posts by this user
Quote this message in a reply
08-28-2020, 01:03 PM
Post: #5
RE: Adding/Editing Programs for the HP50G
(08-28-2020 05:34 AM)Gerald H Wrote:  Remove header line as in posting #3 then open PRG menu & actuate OBJ-> , you should now have the string transformed into the underlying object on stack level 1.

That works only if no syntax errors occur. If a syntax error does occur, the OBJ-> method doesn't reveal where the error is. In that case, see my previous reply for a method that leaves the cursor at the syntax error, which is very helpful if the object is large.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-28-2020, 06:56 PM
Post: #6
RE: Adding/Editing Programs for the HP50G
Joe, Gerald, thank you for your helpful replies.

One question, will the directories be re-created as in the transferred string, or is that something I'd have to re-create on my own?

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-28-2020, 07:02 PM
Post: #7
RE: Adding/Editing Programs for the HP50G
When you successfully parse the string, you will have a directory object on level 1 of the stack, Now enter 'DirName' STO to store the directory in DirName.
Find all posts by this user
Quote this message in a reply
08-29-2020, 03:08 AM (This post was last modified: 08-29-2020 03:08 AM by MattGreer.)
Post: #8
RE: Adding/Editing Programs for the HP50G
Sorry for the trouble folks, thank you for your continued patience.

The problem I'm having is that there are syntax errors within the file. I've attached the file for reference. There's all sorts of CR LF's and quotes and me being unfamiliar with the correct syntax.

So to that end, I manually created a directory with subdirectories and a couple equations/variables on the 50G. I copied that to the SD card and it's binary. Not sure how I could copy it in ASCII. Also, the Greek characters don't translate from the 48GX when copied via the connectivity kit.

It just seems I'm overcomplicating this. When I say "programs", I mean like "4 5 * A STO" Super simple stuff. Isn't there an easy way to create simple things like this using a text editor and save to the SD card? What about the Greek characters?

Thanks again for your patience with me!

Attached (in one zip file):

CHE - the directory and subdirectories I created on the 50G
CHE2 - the directory etc. from the 48GX that I'm trying to migrate to the 50G


Attached File(s)
.zip  CHE2.zip (Size: 3.51 KB / Downloads: 9)

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-29-2020, 03:31 AM
Post: #9
RE: Adding/Editing Programs for the HP50G
OK, so I've figured out this much:

The test directory and subdirectories come across like this, from the 50G to the SD card to the text editor on my PC:

Code:
HPHP49-X,*° DIR
  CH301
  DIR
  END
  CH302
  DIR
  END
  THERMO
  DIR
  END
  EQ { EQ1 HTX }
  HTX 'Q=U*A*dT'
  EQ1 'Q/A=hc*(Tw-T)+˜*“*(Tw^4-T^4)'
END

I delete the first line and characters up to 'DIR' and send that back to the calculator. Put it on the stack and perform OBJ-> and then store that back into the original variable which then turns into a directory so, that works.

One of the issues is that Greek letters don't come across. In this line:

EQ1 'Q/A=hc*(Tw-T)+˜*“*(Tw^4-T^4)'

this part: ˜*“ should be two Greek letter variables multiplied. How can I keep the Greek letters?

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-29-2020, 03:55 AM (This post was last modified: 08-29-2020 01:27 PM by Joe Horn.)
Post: #10
RE: Adding/Editing Programs for the HP50G
(08-29-2020 03:31 AM)MattGreer Wrote:  
Code:
HPHP49-X,*° DIR ...

... One of the issues is that Greek letters don't come across. In this line:

EQ1 'Q/A=hc*(Tw-T)+˜*“*(Tw^4-T^4)'

this part: ˜*“ should be two Greek letter variables multiplied. How can I keep the Greek letters?

Either I'm misunderstanding you, or you are confusing binary with ASCII files. When a "file" from an HP calculator begins with "%%", like in your original post, then it's the ASCII source code which can be parsed by the 50g's edit line (as detailed above). But when the file begins with "HPHP", like in your previous post, then it's the already-compiled binary form, which CANNOT be edited via the edit line of the 50g.

I do not understand why you are saving a 50g program to the SD card (in binary form of course), then recalling it as a string on the 50g. Why would you want to do that? (If I'm misunderstanding you, please be patient with me.... I'm really trying to help here).

Exporting a 48 program in ASCII mode, then importing it to the 50g does make sense, but the instructions for that were already detailed above. Greek letters and other special characters are automatically converted to "trigraphs" such as \<< and \>> for the program delimiters, and \Ge for Greek epsilon. If they are not getting translated that way, execute 3 TRANSIO and try again.

EDIT: I forgot to mention how to translate those trigraphs back into their HP 50g special character equivalents. With the string on level 1 of the stack, execute 3 TRANSIO #2F34Dh SYSEVAL DROP. For example, this converts "\pi" to "π". Then you can do OBJ→ on the string if it contains no syntax errors, or follow the more complicated instructions above if it does contain syntax errors.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-29-2020, 05:56 PM
Post: #11
RE: Adding/Editing Programs for the HP50G
(08-29-2020 03:08 AM)MattGreer Wrote:  ...The problem I'm having is that there are syntax errors within the file. I've attached the file for reference. ...
CHE2 - the directory etc. from the 48GX that I'm trying to migrate to the 50G

There's at least two potential problems I see with this conversion:

- You've used a variable in your 48GX code named "DIFF", which is actually a built-in command on the 50G (brings up a CAS sub-menu). Try renaming your DIFF global variable to something else (DIFF1 perhaps?). I didn't see but a couple references to it, so I don't think that will be too difficult.

- You probably will run into a little trouble in the spots where you used tagged stack levels for the INPUT command. The source code uses carriage returns for that type of construct, and if you do any intermediate editing of the source in text form on a PC you may end up with a mis-match in your CR-LF combinations. I was able to get around this by using the Edit>EOL Conversion>Unix (LF) menu item with Notepad++ on a PC. Something like that may work for you as well.

I don't know enough about your code to be able to test it, but if you address the above issues I believe you may have a good starting point for moving this code over to your 50G.
Find all posts by this user
Quote this message in a reply
08-29-2020, 06:10 PM
Post: #12
RE: Adding/Editing Programs for the HP50G
(08-28-2020 02:18 AM)MattGreer Wrote:  So here are my questions:

  1. Obviously I have to transfer these things from the 48GX in binary for them to work correctly in the 50G, right?
  2. I'd like to be able to edit these things on my computer. How can I transfer over, edit them, and then transfer them back?

  1. No, transfer them as strings. Enter the short programs given in this post on both your 48 and 50. On the 48 use 'OUT' to convert your program to a string.
  2. Transfer the string to your PC using the connectivity kit. You can then edit on the PC. Transfer back to the 48 and use the program 'IN' to convert the string back into a program. If you want to load the program onto your 50G then copy from PC to SD card as text file; extract that file onto the 50G's stack as a string; and run the 'IN' program to convert to a program.
Find all posts by this user
Quote this message in a reply
08-30-2020, 10:52 PM (This post was last modified: 08-31-2020 12:46 AM by MattGreer.)
Post: #13
RE: Adding/Editing Programs for the HP50G
I'll put this at the top:

tl;dr I used a different program to transfer off my 48GX and everything is working with zero issues.

OK, *whew*, I think I've got this resolved. At the end of the day I think this was either a software problem or a software configuration problem (due to the user most likely, which would be ME). Smile

I really, really appreciate you guys' replies and attempts to help. I think the problem was more with the old HP Connectivity Kit (the one from the mid '90's, I think?)

I actually got an old desktop computer out, installed WinXP and the associated software for the HP48GX, HPComm-30r4. But that was giving me problems/errors when I copied the ASCII file that had downloaded from the calc to my computer, and then to the SD card, and then copied internally in the 50g. Something was getting lost in translation. So on my Windows 10 64-bit laptop, I installed the most recent(?) Connectivity Kit for the 50g, conn4x_english.exe. Followed the instructions to get the USB drivers for the 50g installed, and installed the driver for the Trendnet TU-S9 so I could connected the 48GX.

After getting no joy on the 48GX I randomly installed the Xmodem library from the Connectivity Kit and voilà! We're cooking with gas!

I downloaded files and directories in both ASCII and binary mode. When I attempted to upload the binary files to the 50g I got a warning (which I ignored) but uploaded anyway. The 50g couldn't really make heads or tails of the file(s) or directories. But with ASCII it worked completely fine. Even the Greek letters are working.

One example of things "not working correctly", when I'd download from the 48GX using the older software, on Windows XP, the file would have this character as the start of a program: « But with the transfers with the newer program on Windows 10, I'm getting what I saw you guys type in the thread here: \<< Also the formatting doesn't have any line feed/carriage returns with the Win10 transfers.

Can't thank you guys enough for your help! But wait, I have more questions if you'd be willing to stick around a bit more?

If the answer to any of these is "Read The Friendly Manual" please, by all means, say so. Smile

  1. When I downloaded files in binary format, I got files with the extension .hp on my PC. Given that the ASCII transfers worked just fine, I'm wondering why I'd ever use binary (edit: realized later that complied program uploads would, of course, require binary)? And is it possible to edit the binary files on PC? The Debug4x will only open files with a .hpp extension.
  2. Using the CST directory, a while back I was taught that you could create a directory looking graphic using the code # 238572d SYSEVAL. Doing this on the 50g causes a spontaneous reboot. How would I be able to create a directory graphic for the 50g?
  3. What's the directory 'CASDIR' and if I do a factory reset would it show back up?
  4. I'll go look now, but I'm hoping I can get the Periodic Table on this thing as I had on my 48GX. Not really a question but if y'all know that's not possible lemme know.


OK, enuff for now! Smile

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-31-2020, 01:34 AM
Post: #14
RE: Adding/Editing Programs for the HP50G
For item #4, the Equation Library and Periodic Table from the 48 series should already be in your 50g (assuming you have the latest ROM version). Check by pressing [APPS] and look for items 12 & 13.

If they're not there, you can add the libraries in the normal way, they're available here:

https://www.hpcalc.org/details/6515

Good luck

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
08-31-2020, 03:18 AM
Post: #15
RE: Adding/Editing Programs for the HP50G
(08-30-2020 10:52 PM)MattGreer Wrote:  2. Using the CST directory, a while back I was taught that you could create a directory looking graphic using the code # 238572d SYSEVAL. Doing this on the 50g causes a spontaneous reboot. How would I be able to create a directory graphic for the 50g?

That System RPL word is called "MakeDirLabel". Its address in the 50g is #2E1EBh.

(08-30-2020 10:52 PM)MattGreer Wrote:  3. What's the directory 'CASDIR' and if I do a factory reset would it show back up?

CASDIR is a folder containing the system variables used by the built-in CAS system. Its purpose and its contents are all described on page 4-1 and Appendix D of the HP 50g Advanced Users Reference Manual. Yes, it is automatically created by a master reset (ON+A+F, NO), but a far less destructive way to rebuild a mangled CASDIR is to execute the CASCFG command.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-31-2020, 01:33 PM
Post: #16
RE: Adding/Editing Programs for the HP50G
(08-30-2020 10:52 PM)MattGreer Wrote:  1. When I downloaded files in binary format, I got files with the extension .hp on my PC. Given that the ASCII transfers worked just fine, I'm wondering why I'd ever use binary (edit: realized later that complied program uploads would, of course, require binary)? And is it possible to edit the binary files on PC? The Debug4x will only open files with a .hpp extension.

Binary files are essentially objects in the pre-described (or compiled) format that the calculator uses to store them internally. Directly editing one of those files is possible, of course, but there's not really a good reason to do so. It's possible to disassemble some binary objects, but in many cases you would then need specialized tools (and knowledge) to make sense of the resulting code. On a computer, those files are simply meant to be archived or moved around from one calculator to another.

Using something like Debug4x allows you maintain source code (usually *.s or *.h files) which are simply text representations of data and code which can then be compiled into the proper form for use on the calculator. While it can be used for editing UserRPL code, its strengths are more for Saturn assembly and System RPL. *.hpp files are the "master" files which contain references to all of the source files and compilation settings for a given project.

If you want to use a PC for editing User RPL files, you may want to take a look at HPUserEdit. It has some nice features for editing User RPL programs on a PC.
Find all posts by this user
Quote this message in a reply
08-31-2020, 04:20 PM (This post was last modified: 08-31-2020 04:21 PM by MattGreer.)
Post: #17
RE: Adding/Editing Programs for the HP50G
(08-31-2020 01:33 PM)DavidM Wrote:  If you want to use a PC for editing User RPL files, you may want to take a look at HPUserEdit. It has some nice features for editing User RPL programs on a PC.

I'll definitely do that, thank you!

I don't know if the other folks that posted here are still following but there was a lot more information than I realized in this thread, so going back over it after a good bit of trial and error on my part, re-reading, then more trial and error.

Again, many thanks to you all who took the time out of your busy schedules to help me with my growing pains here. Smile

One of the issues I had was when I transferred a 9 KB directory (including formulas, variables, couple small programs, etc.) it didn't all come across in ASCII. It's like, I got "most" of it? Weird. But as it was mentioned in this thread, I think the procedure that works best is as follows:

  1. On the HP48GX, put the directory / variable / program on the stack.
  2. Execute STR→ on what you just loaded onto the stack.
  3. Save the string to a variable
  4. Transfer the variable off the calc to the computer using the Connectivity Kit
  5. Copy the file off the computer, in text mode, to the 50g using the Connectivity Kit
  6. Recall the contents of the variable to the stack
  7. Execute the program (that you're going to enter yourself) called INOUT. (Credit to John H. Meyers and users BruceH and grsbanks for this nifty little routine.)
  8. Save it to the desired variable/directory name on the 50g, and you're done!

Some interesting things:
  • The transferred file from the 48GX to the computer will have an extension .txt on it. If you leave it as a text file for the subsequent transfer, you don't get the"%%" stuff on the first line.
  • If you do remove the extension .txt, it'll add the "%% HP" stuff to the first line of the file during the transfer, so you'll have to go in an manually remove those characters. After that the 'INOUT' routine will do it's thing.

Thanks!

-Matt
Find all posts by this user
Quote this message in a reply
08-31-2020, 10:39 PM
Post: #18
RE: Adding/Editing Programs for the HP50G
(08-31-2020 04:20 PM)MattGreer Wrote:  One of the issues I had was when I transferred a 9 KB directory (including formulas, variables, couple small programs, etc.) it didn't all come across in ASCII. It's like, I got "most" of it? Weird. But as it was mentioned in this thread, I think the procedure that works best is as follows:

  1. On the HP48GX, put the directory / variable / program on the stack.
  2. Execute STR→ on what you just loaded onto the stack.
  3. Save the string to a variable
  4. Transfer the variable off the calc to the computer using the Connectivity Kit
  5. Copy the file off the computer, in text mode, to the 50g using the Connectivity Kit
  6. Recall the contents of the variable to the stack
  7. Execute the program (that you're going to enter yourself) called INOUT. (Credit to John H. Meyers and users BruceH and grsbanks for this nifty little routine.)
  8. Save it to the desired variable/directory name on the 50g, and you're done!

Some interesting things:
  • The transferred file from the 48GX to the computer will have an extension .txt on it. If you leave it as a text file for the subsequent transfer, you don't get the"%%" stuff on the first line.
  • If you do remove the extension .txt, it'll add the "%% HP" stuff to the first line of the file during the transfer, so you'll have to go in an manually remove those characters. After that the 'INOUT' routine will do it's thing.

Change step 2 to:
    2. Execute INOUT on what you just loaded onto the stack.
The INOUT program works on both the HP-48 series and the 50G without change. So it's the best way to get a safe string version of a program to transfer out.
Find all posts by this user
Quote this message in a reply
09-01-2020, 02:42 PM
Post: #19
RE: Adding/Editing Programs for the HP50G
(08-31-2020 04:20 PM)MattGreer Wrote:  ...One of the issues I had was when I transferred a 9 KB directory (including formulas, variables, couple small programs, etc.) it didn't all come across in ASCII. It's like, I got "most" of it? Weird.

There could be some syntactical differences between the models behind this. When the code is parsed on the 50G, it might create situations where the code is interpreted in a different way than it would be on the 48GX (such as the use of the DIFF global variable in your earlier example).

Try moving the source code in smaller "chunks" to see where the translation discrepancies start to show up. That should help to narrow down the location of any problems.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 5 Guest(s)