With the help of this community, I was able to copy and emulate a HP9133 HD using Hpdir and Hpdrive.

Now, I want to edit, or at the bare minimum, read the programs on the HD. I have extracted the programs using Hpdir, but I am at a loss as to how to determine the encoding used. I can see some text (seems to mainly be variable names, see attached example), but try as I may to find the proper encoding, nothing comes out correctly.

Some things worth noting:

  • I have used a number of editors, jEdit seems to have the most encodings available. When I open the programs in jEdit, It defaults to cp-1252 (also known as windows-1252). This is the encoding used in the shown example.
  • I have tried a ton of encodings using brute-force from the supported list in jEdit, none seem to work.
  • HP 9000 Model 310 running BASIC 5.1

Any help would be greatly appreciated! Thanks! Program viewed in jEdit

  • 3
    It's probably not in any character encoding, but in some binary format. Many BASIC interpreters tokenized the source code, replacing keywords with single byte.
    – user722
    Commented Oct 25, 2017 at 1:09
  • 1
    Yes, almost certainly encoded, and quite probably there's some sort of linked list of line numbers interspersed. I assume that if you wanted to transfer further files you'd need to move the hard disk back and forth, which would be burdensome? Otherwise I'd suggest a differential analysis: save 10 LOAD "string", then 10 SAVE "string" and check the difference. If it's one byte then that's a good sign. Try adding a character to string and see whether any numbers increase. Change 10 to 20. Try PRINT. Try PRINT with a number instead of a string. With a variable, etc, etc.
    – Tommy
    Commented Oct 25, 2017 at 1:28

1 Answer 1


HP BASIC doesn't normally save programs in ASCII or any other character encoding. Instead it normally stores the program on disk using an internal representation (probably tokenized like other BASIC implementations). Any file in PROG format isn't in a format you can view in an editor.

However HP BASIC does allow the saving a programs in ASCII format. From Using the BASIC 5.0/5.1 System:

A Closer Look at Storing Programs

To write a program to a mass storage device, you will use either the SAVE or the STORE statement. There is no "right" or "wrong" choice; your choice depends upon the kind of file you want.

  • STORE records an internal representation of the program in a PROG file. The main advantage of a PROG file is a rapid retrieval rate .
  • SAVE records the actual text of the program in an ASCII file. The main advantage of an ASCII file is that it can be read as data by a BASIC program or by LIF-compatible devices (such as other HP computers and terminals).

So if you run the commands LOAD "AUTOST" followed by SAVE "AUTOST_A" on your HP computer you should have a file you can read on your PC, probably called AUTOST_A.ASCII.

  • You are a saint @Ross Ridge! It worked perfectly. Do you happen to know how to handle BDAT files?
    – AMiller
    Commented Oct 26, 2017 at 21:26
  • 1
    @AMiller Sorry, no. HPDir should be able to show you the record size in the directory listing. Beyond that how the data is stored in the file is going to depend largely on how the program choose to store data in the file. Any integer data is probably going to be stored in big-endian order as that's the byte order 68000 CPUs used.
    – user722
    Commented Oct 27, 2017 at 4:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .