HP48

Textdekoration: Augen kucken über den Rand

x48: An emulator for the HP48 Scientific Pocket Calculator

Hello,
this page is dedicated to x48, an emulator for the Hewlett-Packard HP48 Scientific Pocket Calculator models, running on UNIX. In this document I show you how to optain the source package, how to compile, install, dump ROMs, run the emulator. - The reason why I wrote this page is, that I don't like fighting the same fight more than once; so I write down how to hit the target. - I wrote this page in the hope that it may be useful to you, but at the same time making clear, that I am not to blame for any damages that might occur while using my advice. Also there is no garantee of success, "your mileage may vary...". Please excuse any errors, I am not a native speaker; I wrote this page in English to reach more people.

What is the x48

X48 is an emulator for Hewlett-Packard Scientific Pocket Calculator Models HP48S, HP48SX, HP48G and HP48GX. It displays a facsimili of the pocket calculators front, allowing you to type as you would on a real model. It emulates the hardware, so it needs a dump of the firmware ("ROM") to actually run the calculator. The version of ROMs determines, whether it emulates (and looks like) a HP48S(X) or a HP48G(X). See some screenshots in screenshots.html.

Get the sources for x48

The sources of x48 are floating around the whole internet. Any good search engine should guide you to the sources. Search for "x48 emulator". Sourceforge is hosting them, too.

Which version should you obtain? - The latest version I found, was x48-0.4.3. Pick the original package named x48-0.4.3.tar.gz; There are others like x48-040.zip, but these are repacked versions, essentially containing the same code, but with some minor changes like version numbers of files, some CVS stuff etc. They do not hurt, but they may be confusing …

There is also a version x48-0.5.0.tar.gz, which is based on x48-0.4.3, but uses GTK as a windowing toolkit. I have not tried it yet (speaking of Sam Okt 6 19:59:28 MEST 2001). Try it if you want to. – For these descriptions in this document I will stick to x48-0.4.3.

Compiling x48

Put the GNU-zipped tarball x48-0.4.3.tar.gz to some place on your disk, gunzip and untar it.

shell$ X48_DIR="/where/ever/you/want/to/put/x48"
shell$ mkdir -p "$X48_DIR"
shell$ mv x48-0.4.3.tar.gz "$X48_DIR"
shell$ cd "$X48_DIR"
shell$ tar -xzf x48-0.4.3.tar.gz

Now RTFM x48-0.4.3/README and do what it says. It boils down to this:

shell$ cd x48-0.4.3
shell$ xmkmf
shell$ make

Wait until it compiles successfully. This should give you the following executables:

shell$ ls -l bin/*
-rw-r--r--    1 ea1370   users        1035 Nov 28  1994 bin/Imakefile
-rwxr-xr-x    1 ea1370   users        8742 Okt  6 02:10 bin/checkrom
-rwxr-xr-x    1 ea1370   users        7187 Okt  6 02:10 bin/dump2rom
-rwxr-xr-x    1 ea1370   users        6645 Okt  6 02:10 bin/mkcard
-rwxr-xr-x    1 ea1370   users      284795 Okt  6 02:10 bin/x48

Obtaining ROMs for x48

There are two ways for obtaining the ROM for your HP48 model:

  1. Dump it from your own HP48. Here is a cite from x48-0.4.3/README:

    This emulator is capable of providing a faithful replication of the HP48. In order to do so, it requires a copy of the ROM software from YOUR calculator. In order to avoid breaking copyright laws, and upsetting HP, you MUST BE THE PROUD OWNER OF AN HP48 before running this program.

  2. In year 2000 HP released most of the ROM versions on http://www.hpcalc.org/hp48/pc/emulators/. You can download them from there, look out for "HP 48?X Revision ? ROM" etc.

Dumping ROMs from your HP48

If you chose the easy way (downloading the ROMs from the internet), skip this (lengthy) chapter.

Here is the conceptional overview of what follows: We need to install a program on your HP48 that reads its ROM from the beginning to the end, converts all the content to a special readable format (kind of hexdump), dumps it on the serial port of your HP48; on the other end of the cable we will make kermit listen for what is coming from your HP48; kermit logs everything to a session log file; afterwards we need to convert the special readable format (hex dump format) to the ROM format the x48 emulator program understands.

Make shure your have the following available:

  1. the serial cable with the special HP48 connector
  2. your own HP48 model
  3. a serial port with read- and write-permissions to it. For my instructions here I will stick to TTY="/dev/ttyS1":
    shell$ TTY="/dev/ttyS1"
    shell$ ls -l "$TTY"
    crw-rw----    1 uucp     uucp       4,  65 Okt  6 18:25 /dev/ttyS1
    shell$ id
    uid=500(ea1370) gid=100(users) groups=100(users),14(uucp)
    
  4. the kermit communication package "ckermit" is installed and working on your box; you find it in your Linux distribution as package ckermit (Debian: ckermit (?); SuSE series: n; RPM group: Applications/Communications)

Now connect the cable to $TTY and to your HP48.

We need to configure the communication parameters on both ends. Type into your HP48:


ON
<-
I/O

Choose menu SETUP and configure it like this:

IR/wire:        wire
ASCII/binary:   binary
baud:           9600
parity:         none 0
checksum type:  1
translate code: 3

Leave this menu by hitting the ATTN key.

Make your HP48 ready for receiving the ROMDump program. Go to the I/O menu and start the server (this means: start the kermit server mode, waiting for commands). On a HP48S model type you can type the following sequence as a shortcut:


->
I/O

Your HP48 responds with "Awaiting Server Cmd." - Good.

Now start kermit.

shell$ cd "$X48_DIR"
shell$ mkdir ROMs
shell$ cd ROMs
shell$ kermit -l "$TTY"
C-Kermit 7.0.197, 8 Feb 2000, for Linux
 Copyright (C) 1985, 2000,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
Linux Kermit>set speed 9600
/dev/ttyS1, 9600 bps
Linux Kermit>set carrier off
Linux Kermit>set parity none
Linux Kermit>robust
Linux Kermit>send ../x48-0.4.3/romdump/ROMDump
[transmission feedback screen; see also your HP48 receiving packets...]
Linux Kermit>

Hit the ATTN key on your HP48 to exit receive mode.

Now we dump the HP48's ROM to your computer. In kermit type:

Linux Kermit>log session
Linux Kermit>connect
Connecting to /dev/ttyS1, speed 9600.
The escape character is Ctrl-\ (ASCII 28, FS)
Type the escape character followed by C to get back,
or followed by ? to see other options.
(Session logged to session.log, text)
----------------------------------------------------
`# N3

If you have a HP48 S/SX type, type the following into your HP48 and press the ENTER key afterwards:

#0h #7FFFFh ROMDump

If you have a HP48 G/GX type, type the following into your HP48 and press the ENTER key afterwards:

#0h #FFFFFh ROMDump

This will take about 15 minutes on the S/SX, 30 minutes on the G/GX. Get a good cup of coffee/tea/choclate/coke/beer/water/foo/bar and watch the the hexdump of your ROM roll over the kermit screen... After the dump has ended at its end address, in kermit hit "Ctrl-\" and then "c". Exit kermit by typing "quit".

00000:2369B108DADF1008
00010:5E46187F40030680
00020:696E4157186F0006
00030:80696A8028618113
[...]
7FFC0:2A2B2130607E5AE4
7FFD0:E5AE4E5F6B264423
7FFE0:079470B213000000
7FFF0:84054383D2A42069
Ctrl-\
c
(Back at r2d2)
----------------------------------------------------
Linux Kermit>quit
Closing /dev/ttyS1...OK
shell$ 

Now we have the hexdump of your HP48's ROM in the file session.log, which was created by kermit. Now this must be converted into the binary format which is understood by the x48 emulator program. Here we go:

shell$ ls -l
-rw-r--r--    1 ea1370   users      753674 Okt  6 22:08 session.log
shell$ ../x48-0.4.3/bin/dump2rom session.log
shell$ ls -l
-rw-r--r--    1 ea1370   users      262144 Okt  6 22:44 rom.dump
-rw-r--r--    1 ea1370   users      753664 Okt  6 22:44 session.log
shell$ ../x48-0.4.3/bin/checkrom rom.dump
ROM Version is HP48-J
ROM CRC reads 0x9602
IROM OK: ROM CRC test passed.
shell$ mv rom.dump HP48-J.rom

Running x48

Now you have your own ROM in $X48_DIR/ROMs/HP48-J.rom. The version number (here: character J) may vary, depending on your HP48 model. We can now start using the x48 emulator program:

shell$ ../x48-0.4.3/bin/x48 -rom HP48-J.rom

A window should pop up, showing a rendition of your HP48 models front. It asks you "Try To Recover Memory? - Yes, No" - Answer "No". It says "Memory Clear" and shows the normal stack und prompt. - Rejoice! Start using it...

The x48 emulator program changes the rendition of your HP48 models front depending on the ROM version your give with the -rom command line parameter when you first call it. See some screenshots in screenshots.html.

x48 creates the directory $HOME/.hp48/ where it stores the ROM, the state of the RAM and other stuff.

Known Problems

In my experience, when using ROMs with version "J", the x48 emulator program dumps core while initialising. I have not figured out the reason. - The workaround is to use a different ROM version. Version "E" works for me. Download one from the internet (see: the easy way...).

Further Reading

As the file x48-0.4.3/README says at the end:
Have Fun.

Other useful links


© 2001 ich
Created: Son Okt  7 00:46:52 MEST 2001
Last updated: 
2007-07-15T18:41:38+0200
EOF