Post Reply 
HP 50g & SD Cards: Performance, Format, Notes
09-10-2016, 01:58 AM
Post: #114
RE: HP 50g & SD Cards: Performance, Format, Notes
(09-09-2016 11:53 PM)JDW Wrote:  First, the utility you pointed me to appears to be a COMM transfer tool that has nothing to do with my desired means of transferring User RPL programs from a computer to the 50g via SD card.

I wasn't so much trying to get you to use it as I was simply pointing out that if the transfer tool is used, you can have it manage the translation to and from "mode 3" objects (the type that have individual characters replaced by digraphs).

The digraphs may be somewhat crude, but it's about the most transportable way of expressing the special RPL characters on a wide variety of platforms that we can use. That's why you'll see them cropping up in posts from time to time.

(09-09-2016 11:53 PM)JDW Wrote:  What I want to do is be able to easily copy any System RPL code, say out of a forum post, with or without those backslashes, and with or without a header line, and then wave my magic wand to have it encoded properly such that I can save that to an SD card and then easily put it in the stack using the 50g.

Let me know when you get that wand. A lot of people would love to have one! You stated System RPL above, but for purposes of this discussion there is a distinct difference between User RPL and System RPL. In native form on the calculator, User RPL source code will have special characters scattered throughout that aren't part of the ANSI standard codepage. At the very minimum, the opening and closing brackets (each of which is a single character). Most User RPL programs will have others as well, and some commands (such as square root) have no standard ANSI in them at all.

System RPL source code on the calculator is simply standard ANSI text. Once compiled, it's a binary object, of course. But the source code character set is actually simpler than User RPL.

(09-09-2016 11:53 PM)JDW Wrote:  So with regard to your previous post, I have the following two questions:

1. Are you saying that I can copy your posted code with header into my Mac's text editor and then save that as an extentionless text file to an SD card and then be able to insert that SD into the 50g and use it? If so, what text encoding must I use in the text editor on my Mac to properly save it to the SD card?

I am, provided that you are referring to the version with the digraphs. But it will require the use of a supplemental program (James Prange's "TxtToObj") that can be found in the link that I provided in the previous post. The text encoding should be ANSI/UTF-8. I no longer use Macs on a regular basis, so there's probably other ways to do similar things that I'm sure folks here will volunteer.

(09-09-2016 11:53 PM)JDW Wrote:  2. Your 3 steps involving TRANSIO and SYSEVAL work on what, exactly? For example, so long as I do NOT have a header line, and so long as the code is backslash-escaped (or does that matter?), I can paste such User RPL code into a Mac text editor and then save that as a single extentionless file to my SD card (but again, saving with what text encoding? UTF-8?) and then follow your 3 steps with success?

They work on a string placed on the stack that starts with "\<<" and ends with "\>>". And everything in the string has to be valid, as in regular ANSI characters and all "escaped" combinations must be valid digraphs. Otherwise the parser will give up. Note that the output of the SYSEVAL step is still simply a string; it doesn't become compiled code until you execute the last step. Yes, the same method of saving the text file to the SD card as above should work. The primary difference in this second method is that source code DOES NOT have the header line. If you have that line, just use TxtToObj.

If I were in your situation, I would simply add any missing headers before saving the text file to the SD card. It's not that hard to do, and keeps you from having to mess with SYSEVALs and other extra steps.

Many moons ago when I was still using a Mac with my HP calculators (it was well before OS/X), I had a special "HP48" font that properly mapped the HP character set to the ascii codes used natively on the calculator. Using that, I could transfer files back and forth without needing to using digraphs, due to the special font allowing me to see all the proper characters. But that was a "closed system", and I wasn't in a position to share code online at the time. The landscape is quite different now. The widespread use of Unicode and a variety of code pages for character mapping has made it difficult to deal with all the possible variants of text encoding in common use. As archaic as it is, the use of digraphs is still the best way I know of to share User RPL code on a wide variety of platforms.

Note that all of this is focused solely on moving text TO the calculator. Going in the opposite direction is similar (there's an ObjToTxt command to complement TxtToObj), but there's one extra consideration: the O/S on the calculator will prepend a special series of byte codes to whatever you save on the SD card -- even a text string. You can usually delete those characters with a text editor on your computer, but there's also a library (SDFiler) that provides a command to save to the card without the header prepended.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 50g & SD Cards: Performance, Format, Notes - DavidM - 09-10-2016 01:58 AM



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