Post Reply 
file format for HP48gx objects
07-06-2021, 07:43 PM
Post: #1
file format for HP48gx objects
I'm using the iHP48 emulator on my iPhone configured as a HP48gx. I own a HP48sx but the keyboard is a bit flakey so the emulator is a great backup. Program works great and i'm able to save and load objects from the phone's file system into the calculator. However, i'd like to edit my HP programs on my mac then load onto my phone. The problem is i don't understand the structure of the object files. Examples attached as a zip file.

file "a" = << >> (empty program)
file "b" = << 1 'A' STO >>
file "c" = << 2 'A' STO >>
file "d" = << 1 'B' STO >>
file "e" = << 2 'B' STO >>
file "f" = << 'A' RCL >>
file "g" = << 'B' RCL >>

I would be very grateful if someone could help me understand the internals of the attached files or point me to a reference. My goal is to build a python script that can translate between ASCII representation of a program and the binary version the calculator requires.


Attached File(s)
.zip  hp_objects.zip (Size: 3.18 KB / Downloads: 6)
Find all posts by this user
Quote this message in a reply
07-06-2021, 08:18 PM
Post: #2
RE: file format for HP48gx objects
Hi,

I'm afraid I can't help you much directly, as I only know a little about HP 48 objects myself. However, I have done some research for one of my projects, and I can tell you this: it's complicated, and there isn't really an easy way around that. You have to be able to read and deal with plain nibbles (though you probably knew that already, didn't you? Smile). As a result, it may be worth learning a bit of C, if you don't know it already, because the ability to deal with sizes of numbers and pointers will simplify the challenge quite a bit.

Since I myself am not much help, here's some resources that have helped me. One really good, though large, reference is https://www.hpcalc.org/details/4576. This documents every binary object type in the 48SX. Another source, which may be more readable, is the 3rd edition of "Introduction to Saturn Assembly Language", which I've browsed through and I know it has a chapter on objects. hpcalc.org surely hosts more information, so don't be afraid to search for what you need.

Good luck! I think that a tool like what you want to create would actually be really useful.
Find all posts by this user
Quote this message in a reply
07-06-2021, 10:37 PM
Post: #3
RE: file format for HP48gx objects
Thank Liam. This was very helpful. I'm already noticing a pattern. It seems some of the byte code is written in the reverse order!

Daniel
Find all posts by this user
Quote this message in a reply
07-07-2021, 12:10 AM (This post was last modified: 07-07-2021 12:24 AM by DavidM.)
Post: #4
RE: file format for HP48gx objects
(07-06-2021 07:43 PM)djb146 Wrote:  My goal is to build a python script that can translate between ASCII representation of a program and the binary version the calculator requires.

This would be far more involved than you may realize. Objects that are stored on an RPL calculator are stored in a compiled format. They are only in ASCII form while you are editing the object using the standard editing features on the calculator. As soon as you are done editing, the object is actually compiled into a binary form. All objects (other than strings) are stored in binary form on the calculator.

EDIT: That last sentence is probably misleading. Strings are actually stored in compiled form as well, but they are simply easier to open/view on other systems. The mapping of special RPL characters is unique, so some of the characters won't look the same on another platform as they do on the calculator.

See the two commands →STR and STR→ for a built-in way to translate User RPL objects on the calculator to and from ASCII form.
Find all posts by this user
Quote this message in a reply
07-07-2021, 05:47 PM
Post: #5
RE: file format for HP48gx objects
Thanks for the info David. I don't have the time or interest to build a compiler from scratch so i'll have to find a work around. The ->STR and OBJ-> commands may be a workable solution. The quest continues ...
Find all posts by this user
Quote this message in a reply
07-08-2021, 11:02 PM (This post was last modified: 07-09-2021 11:55 AM by Nate.)
Post: #6
RE: file format for HP48gx objects
These may be helpful:

https://www.hpcalc.org/details/3671
https://groups.google.com/g/comp.sys.hp4...zxPAvZfk4J

https://groups.google.com/g/comp.sys.hp4...MkFDgrHH4J
https://groups.google.com/g/comp.sys.hp4..._q2_kMBqwJ
Find all posts by this user
Quote this message in a reply
07-09-2021, 07:20 PM
Post: #7
RE: file format for HP48gx objects
Thank you all. Problem mostly resolved. First, I switched to the HP48sx emulator on iHP48. From there I was able to use the DOS-based HP-48.exe (v2.61) compiler (HP-48.exe) inside "DOSBOX". Once compiled, i copied the program from my Mac to my iPhone and into a directory the iHP48 could use.

Not ideal but satisfactory.
Find all posts by this user
Quote this message in a reply
Post Reply 




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