Emu48 - A freeware HP38G/39G/40G/48SX/48GX/49G Emulator
for Windows 9x, ME, NT, 2000, XP, Vista, 7, 8, 10 and 11

1. General

2. Acknowledgements

3. ROM Images
3.1 Creation examples

4. Installation

5. How to Start

6. Command Line

7. Virtual Keyboard

8. File Menu
8.1 New...
8.2 Open...
8.3 Save
8.4 Save As...
8.5 Close
8.6 Settings
8.6.1 Settings General
8.6.2 Settings Memory
8.6.3 Settings Peripheral
8.7 Exit

9. Edit Menu
9.1 Load Object...
9.2 Save Object...
9.3 Copy Screen
9.4 Copy Stack
9.5 Paste Stack
9.6 Reset Calculator
9.7 Backup
9.7.1 Backup Save
9.7.2 Backup Restore
9.7.3 Backup Delete

10. View Menu
10.1 Change KML Script...

11. Tools Menu
11.1 Disassembler...
11.2 Debugger...
11.3 Macro
11.3.1 Macro Record...
11.3.2 Macro Play...
11.3.3 Macro Stop
11.3.4 Macro Settings...

12. Help Menu
12.1 Help Topics
12.2 About Emu48...

13. DDE Server

14. License

# 1. General

Emu48 is an emulator for the Hewlett Packard HP38G, HP39G, HP40G, HP48SX, HP48GX and HP49G calculator hardware. These calculators are based on the 1LT8 Clarke (HP48SX) and on the Yorke chip.

# 2. Acknowledgements

First of all a big thank to Sébastien Carlier for publishing Emu48 v1.0 under the GPL. Without this decision newer versions of the emulator wouldn't have been possible or ports to other similar calculators wouldn't have been made. Also a big thank to Jean-Yves Avenard for his technical assistance in the beginning. Lode Vandevenne spent the PNG image decoder and finally I want to thank all the unnamed authors for publishing material about these calculators.

# 3. ROM Images

Emu48 needs a ROM image for each calculator model you want to emulate. ROM images are valid in a packed (even address lower nibble, odd address higher nibble) or unpacked (one nibble per byte with even address first) form.

Since fall 2000 the emulator ROM's for the HP38, 39, 40, 48 and 49 are freely available on different Internet sites. Because there's no license for the distribution of the ROM images, they aren't included in the Emu48 package. Since accepting packed ROM images, in most cases converting the given ROM format (which is regulary a packed ROM image) into the native Emu48 ROM format is not necessary any more. You can still use the classic way extracting them from your own calculator.

The command line Convert utility delivered with the Emu48 program package was originally designed to convert HP48 ROM images files from one of the various used ROM image formats of the 90s to the unpacked format originally used by Emu48. The 2nd important task of this tool is updating the I/O register area with zeros. Most images had been created with a ROM upload program where the I/O register area was mapped over the ROM content and so the ROM image file contain a wrong content at this position. Executing the selftest on a HP38 or a HP48 will report an IROM fail then. To fix this the Convert utility overwrites the I/O register area in the destination file with zeros. Final notice, the convert utility shows the CRC result after the file convert and a passed ROM CRC test does not imply, that the source file is in an Emu48 suitable format! To create a ROM image in a suitable format, call the convert utility with the 2nd file argument.

The general syntax of the convert utility is:

> Convert [-p] <old-rom-dump> [<new-rom-dump>]

where:

> Convert <old-rom-dump>

check if <old-rom-dump> is in a known source format and report the ROM Model, the ROM Version and the result of the CRC check.

where:

> Convert <old-rom-dump> <new-rom-dump>

convert the file <old-rom-dump> into the unpacked ROM image file <new-rom-dump> valid for use in Emu48.

where:

> Convert -p <old-rom-dump> <new-rom-dump>

convert the file <old-rom-dump> into the packed ROM image file <new-rom-dump> valid for use in Emu48.

## 3.1 Creation examples

- HP38

  To upload the ROM of your HP38G, you will need a special aplet called "ROM UPLOAD". Once you've uploaded the ROM, you have to convert it using the Convert utility.

  To do that, start a Command Prompt while running Windows, and type:

  > Convert -p <rom-file> ROM.38G

  Where <rom-file> is the path to your ROM image. This will create a packed file named ROM.38G. This tool will also check its validity.

- HP39/40

  To upload the ROM of your HP39G/HP40G, you will need a special aplet called "ROM UPLOAD". Once you've uploaded the ROM, you may convert it to the unpacked format using the Rom2emu utility or rename it when you want to keep the packed format.

  To do that, start a Command Prompt while running Windows, and type:

  > Rom2emu <rom-file> ROM.39G

  or

  > rename <rom-file> ROM.39G

  There's also a HP39G/HP40G beta ROM for emulators inside an old Emu48 package.

- HP48

  If you have already used another HP48 emulator, you can convert the ROM using the Convert utility.

  To do that, start a Command Prompt while running Windows, and type:

  > Convert <rom-file> ROM.48G

  or

  > Convert <rom-file> ROM.48S

  Where <rom-file> is the path to your old ROM image. This will create a file named ROM.48G or ROM.48S, depending on the version you own. This tool should be able to read any style of ROM image, and will also check its validity. Note that if you run it with only one parameter, no file will be written, but it will still check the validity of the ROM.

  If you have never used an HP48 emulator, and don't have a ROM dump, you can either use Jean-Yves Avenard's ROMUPL.BIN or the ROMDump Wizard V1.x, which will almost automatically get the ROM from your HP48. After the download you may have to convert your dump with the CONVERT utility into the Emu48 format.

  You can find the latest version of the ROM dump programs on:

  > ROMUPL.BIN http://www.hpcalc.org/details.php?id=3686
  > ROMDump Wizard https://hp.giesselink.com/emu48.htm

- HP49G

  There's no ROM download program available so far. But you can create a ROM image with the UPD49ROM tool and a ROM update file for the HP49G calculator. I suggested to use version 1.19-6

  To create a HP49G ROM image file, start a Command Prompt while running Windows, and type:

  > UPD49ROM -f hp49119-6.flash ROM.49G

  This will create a HP49G ROM image file with an empty User Port 2.

# 4. Installation

To install Emu48 you may use the installer package which contain, among the binaries, some HP48 KML scripts or just unzip the emulator and the required emulator skins from archives into an empty directory. Finally copy your ROM images into this directory and adjust the ROM image name to the name used in the corresponding KML script. When you first run Emu48, it will detect the directory in which you installed it, and will write the configuration to the registry at HKCU\Software\Emu48.

# 5. How to Start

When Emu48 is installed and you have put valid KML scripts and the corresponding ROM image(s) into your Emu48 installation directory, you can start Emu48. You'll see a "Choose Your KML Script" box.

KML (Keyboard Mapping Language) scripts define the visual aspect of Emu48, the behaviour of the buttons, of the keyboard, ... It's a great way to customize your copy of Emu48.

Check in this dialog that the path in the "Emu48 Directory" text area points to the directory in which you installed the Emu48 KML files. Click the refresh button ("V") after modifying the directory path manually to update the list box or use the ("...") button to start a directory browser.

Choose a KML script in the list box for your calculator ROM you put into Emu48's directory.

Several HP48 scripts are included in the Emu48 archive:

- Emu48's Default Faceplate for HP48G/GX
- Emu48's Default Faceplate for HP48S/SX

  These two are simple scripts, good for 800x600 display resolution.

- Casey's Gx with Toolbar and Touch Screen
- Casey's Sx with Toolbar and Touch Screen

  These script uses many advanced features, and is a good demonstration of the power of Emu48's scripting language KML. Try it, it is really great!

- Floating buttons

  This one looks really great.

- Small but realistic HP48 Gx

  This one has been designed for small resolutions such as 640x480.

If you want other great scripts, visit Rechlin's great HP archive

If you are interested in writing new scripts, get the KML 2.0 documentation from the authors Emu48 page.

Having selected a script, press OK to start the emulator. In most cases, when Emu48 crash after pressing the OK button, you are using an invalid ROM image. While it's running, you can use the "View/Change KML Script..." command to change the visual aspect of Emu48.

# 6. Command Line

The command line syntax is "Emu48 [E48file [Port2file]]". The first parameter sets the filename of the emulation data independent from the "LastDocument" setting, normally reponsible for opening the last used state file. The second parameter the Port2 file. You're not able to set a Port 2 file without setting the emulation data file. The arguments are optional.

# 7. Virtual Keyboard

There are two ways to use the virtual keyboard on the emulated calculator:

1. by Mouse
2. by PC keyboard

The easiest way to use the emulated calculator is by using the mouse. The KML script defines buttons with an area where mouse clicks take effect. The active area is indicated by changing the cursor from an arrow to a hand cursor. Pressing the left mouse button over an active area will press the virtual button. When the mouse cursor leaves the virtual key area with still the left mouse button pressed, the virtual button is automatically released. The visual aspect of a pressed or released virtual button is defined in the KML script. In some cases you need to press more than one key on the emulator. For these cases press the virtual key with the right mouse button. When you release the mouse button or leave the area of the virtual key, the key is still held. To release all held virtual buttons, just use the left mouse button again. A single release of a hold virtual key isn't possible.

Another convenient way is using the PC keyboard. The KML script language supports a large variety of commands to implement this feature. So keyboard usage mostly depends on your used KML script and not on the emulator. Because of this it's impossible to say what's happen when you press a key on the PC keyboard. Some Windows specific accelerator keys like F10 cannot be overloaded by the KML script. For further details read the KML 2.0 documentation mentioned before please.

# 8. File Menu

## 8.1 New...

Creates a new emulation session. You're asked for a KML script where you can select the calculator type and skin to emulate.

## 8.2 Open...

Opens a previously saved emulation session. The emulation continues at the same position where the session was aborted. Loading emulation sessions made with a different ROM revision may destroy the memory content or may cause other unpredictable results.

## 8.3 Save

Saves the current session with the actual name.

## 8.4 Save As...

Saves the current session with a new name. You're also get this dialog when you Exit a new session without a state file name.

## 8.5 Close

Closes the current session without closing the emulator.

## 8.6 Settings

This calls the Settings dialog. This dialog has three tabs: General, Memory and Peripheral.

### 8.6.1 Settings General

#### 8.6.1.1 Section General

- Authentic Calculator Speed

  When this option is checked, the emulation speed will be similar to the real calculator depending on the RATE control register content.

- Enable Virtual LCD Delay

  Try this option for a better 4 color gray scale display simulation output.

- Always On Top

  When this option is checked, the emulator window will always be the topmost one.

- Activation Follows Mouse

  This option enables a X-Mouse style windows activation. When the mouse is moved over the emulator window, the emulator is getting the focus and popping up into foreground.

- Single Instance

  When this option is checked, only one instance of the emulator can be started. If another running instance is detected, the detected instance is set into foreground as active window and get a request to change his state file to the given one by the current instance. Then the current instance is terminated.

- Automatically Save Files

  When this option is checked, the current state file will automatically saved when you change to another state file, but not when you close the emulator program.

- Automatically Save Files On Exit

  When this option is checked, the current state file will be saved automatically when the emulator program is closed.

- Show Load Object Warning

  When this option is checked, you'll get a warning message box when you try to load an object with the Load Object... menu command. If this option is unchecked, the warning will be skipped.

- Always Show KML Compilation Result

  When this option is checked, you see the results of the KML (Keyboard Mapping Language) interpreter at every KML script load.

#### 8.6.1.2 Section Style

- Show Title

  When this option is checked, the window title bar is visible.

- Show Menu

  When this option is checked, the menu bar is enabled. If unchecked, the menu is accessible as context menu in the client area outside the calculator button definitions.

#### 8.6.1.3 Section Disassembler

Choosing the assembler syntax:

- HP Mnemonics

  This is the standard syntax used by HP.

- Class Mnemonics

  Class (Clarke assembler) was written by Lutz Vieweg in 1991, at a time when HP had not published their own development tools. The syntax is very similar to the AG and STAR mnemonics used at this time. Especially published assembler programs written for the HP28S use the similar AG syntax.

### 8.6.2 Settings Memory

#### 8.6.2.1 Section Memory Cards

- Port 1 is Plugged

  When this option is checked, a 128 KB RAM card is emulated in card Port 1. The RAM card content is saved in the current emulator state file.

- Port 1 is Writeable

  When this option is checked, the RAM card in card Port 1 is writable else the card is Read-Only by simulating the card write protect switch.

- Port 2 is Shared

  When this option is unchecked, only the first instance of Emu48 will allow you to use the RAM card in Port 2. When this option is checked, the first instance of Emu48 will give you both read and write access to this RAM card. If you start Emu48 in another instance, the RAM card in Port 2 will be write-protected. Thus you can transfer files very easily between two calculators. This RAM card is used by both S/SX and G/GX types.

- Port 2 is Writeable

  This option represents the actual read/write state of the Port 2 file. Changing the option will also change the state for the calculator by modifying the Read-Only attribute of the file.

- Port 2 File

  You can add a RAM card of up to 4MB to a HP48. By default, no such card will be created when you start Emu48. The MkShared.exe utility will allow you to create one. To create a Port 2 RAM Card, call the program, select the RAM Card size, enter the card file name and press the 'Create' button. That's it. Please remember, this program replace the destination file without any request!

  If you already have a Port 2 card file in unpacked format, you have to copy the file into the emulator directory. If you choose a different directory you have to use a full path file name.

  If you use RAM cards greater than 128 KB in a HP48SX, you can only see the first 128 KB of the card. Please remember, the firmware of all HP48GX versions has a bug when using a 4 MB RAM card. You always get the message "Warning: Invalid Card Data" at startup and Port 33 is inaccessible. This is not a bug of the emulator!

  When you have created or copied the file, enter the card file name into the Port 2 File edit box.

  Please remember, all port configuration changes mostly behave like on the original calculator. This means when you do this changes with the emulated calculator on, it's the same like when you do this with a real calculator on. In many times, this depends on the current state of the calculator, this will work without any problems by doing an automatically calculator warmstart. But for the most secure way, switch off the emulated calculator first, please!

### 8.6.3 Settings Peripheral

#### 8.6.3.1 Section Sound

A new implementation of the sound engine made ROM patches for sound output obsolete. The new sound engine emulates the behaviour of the beeper output ports and only work in connection with a sound card. Using the legacy PC speaker mode isn't possible any more. The old beeper method with a ROM patch has been removed, so you have to remove the ROM beep patches from your KML scripts. Actually the program informs you when detecting ROM beep patches by opening the "KML Script Compilation Result" dialog reporting an error.

For the sound generation the calculator must know his own CPU strobe frequency. On the real calculator the speed depends on various settings like component tolerances, actual temperature, humidity and other variables. The actual speed is measured by the calculator firmware at a cold- or at a warmstart and stored in the =CSPEED variable. The content of this calculator variable has direct influence on the resulting frequency and duration. On the emulator the HP48SX CPU strobe frequency is set by the registry key HKCU\Software\Emu48\Emulator\SXCycles, for all other calculators at HKCU\Software\Emu48\Emulator\GXCycles. For some reasons the CPU cycles are only estimated and so the strobe frequency value in the registry is not the exact CPU strobe frequency of the calculator in Hz divided by 16384 like in the other emulators. Because older versions of the emulator were not able to measure the CPU strobe frequency properly or the strobe frequency registry content has been changed since the last measurement, the =CSPEED variable of this session file may contain a wrong frequency value. You easily may discover this by measuring the real duration of a 10s beep. A deviance less than 1s is ok, otherwise you should perform a warmstart of the calculator in this session file. Alternatively you may execute a Reset Calculator. This recalls the measuring routine and save the result in the speed variable. Both restart variants purge the stack content!

- Volume

  The output volume can be set with the Volume slider relative to the Windows Master Volume control.

- Device

  By default the sound device is set to "Standard Audio", but you can also manually choose the output device. When you change the Standard Audio device in the Operating System settings dialog, the internal device numbering may change, and so the manually selected audio device.

#### 8.6.3.2 Section Infrared Printer

The emulator has the ability to print data to a HP82240A/B printer simulation. The data transfer to the printer simulator is done over UDP. In this section you can the define the IPv4 address and the port the printer simulator is listening. A suitable HP82240B printer simulation can be found here.

#### 8.6.3.3 Section Serial Ports

- Wire

  In the Wire combo box you can select the COM port device connected to the wire port of the calculator.

- Ir

  In the Ir combo box you can select the COM port device connected to the IR port of the calculator. Please remember that the IR port only work with 2400 baud.

## 8.7 Exit

Quit emulation. The default actions at finishing are defined in the Settings dialog. If the current session is "Untitled" you are asked for a session file name using the Save As... dialog. If you quit the emulator without a given filename, you're asked for choosing a KML script at next startup.

# 9. Edit Menu

## 9.1 Load Object...

This is only valid for the HP48SX, HP48GX and the HP49G emulation. You can load HP48 and HP49G binary objects to stack level 1. Therefore the object must begin with "HPHP48-x" for a HP48 or with "HPHP49-x" for a HP49G binary object where x can be any alphanumeric character. If the binary header isn't present, the object is loaded as string. Dropping HP objects over the emulator window will also load objects. Be sure that the emulator isn't busy before doing this.

## 9.2 Save Object...

This is only valid for the HP48SX, HP48GX and the HP49G emulation. Save the current object in stack level 1 as binary object to disk.

## 9.3 Copy Screen

Copy the screen content as bitmap to the clipboard.

## 9.4 Copy Stack

This menu item is enabled for the HP48SX, HP48GX and the HP49G emulation.

Copy a "Real Number", "Complex Number" or "String" object in stack level 1 to the clipboard. On all other objects, the command will be ignored. This prevents sending binary objects to the clipboard.

The decimal point of "Real Numbers" in the clipboard is equal to the calculator setting. This is important when you try to paste the numbers into a program using the locale settings of the host operating system.

## 9.5 Paste Stack

This menu item is enabled for the HP48SX, HP48GX and the HP49G emulation.

Paste the text field content of the clipboard to stack level 1 of the emulated calculator. If the clipboard content is representing a real number, the number will be saved as "Real Number" object. Is the content a complex number object, the number will be saved as "Complex Number" object, otherwise cases as "String" object.

To import "Real Numbers" from the clipboard, the decimal point character of the clipboard and calculator must not match any more. There's an auto detection for decoding the thousands separator and decimal point character. The thousands separator is removed at decoding. A real number is detected in the case of valid real number characters in the clipboard.

"Complex Numbers" must be in the form (a,b) when using the decimal point or in the form (a;b) when using the decimal comma. Using a thousands separator is not allowed in complex number strings because in decimal point mode, the comma is used as separator between real and imaginary part of the number. The Cartesian or algebraic form a+bi is not supported.

## 9.6 Reset Calculator

This emulates the Reset pin of the internal CPU.

## 9.7 Backup

### 9.7.1 Backup Save

This saves the current emulator status into a backup slot. If the backup slot already contain data, it will be overwritten.

### 9.7.2 Backup Restore

This restores a previous saved emulator status without request. If you changed the calculator model meanwhile, the emulator will switch back to the model used in the backup.

### 9.7.3 Backup Delete

This deletes the data in the backup slot.

# 10. View Menu

## 10.1 Change KML Script...

This allows you to change the skin of the current emulated calculator. In opposite to the New... command you see only scripts emulating the same calculator model.

# 11. Tools Menu

## 11.1 Disassembler...

This is a simple disassembler.

Enter the address to disassemble in hexadecimal into the "Address (HEX)" field and press <Return>. With the "Next Address" button the next opcode is disassembled. With the "Copy Data" button you can copy all selected lines from the list box to the clipboard.

## 11.2 Debugger...

The assembler code debugger of the emulator. For more details refer to the extra documentation of the debugger please.

## 11.3 Macro

The keyboard macro recorder unit.

### 11.3.1 Macro Record...

Prompts a dialog to enter the macro file for the data to record. After accepting the confirm message, every key event is recorded into the macro file with it's time information.

### 11.3.2 Macro Play...

Prompts a dialog box to ask for the keyboard macro file to play. The replay starts immediately after opening the selected file.

### 11.3.3 Macro Stop

Stops recording or replaying a keyboard macro file.

### 11.3.4 Macro Settings...

Settings for the Macro Replay mode

- Real

  Replay macro with the original recording speed.

- Manual

  Replay macro with the speed set by the speed slider.

# 12. Help Menu

## 12.1 Help Topics

Show this document.

## 12.2 About Emu48...

Show the version, copyright and license message...

# 13. DDE Server

Emu48 has an integrated DDE server to transmit data from and to the HP stack. Because only the HP48 and HP49 have a stack, all DDE transfers are ignored on the other calculators. You have the same restrictions like with the commands "Load object..." and "Save Object...", that a running program may corrupt memory. In difference you can choose the stack level for the transfer in the DDE item field. Take care to transmit data only after the acknowledge of the last DDE transaction.

Technical data:

Servicename: | Emu48
Topicname: | Stack
Item: | 1 (stack level)
Clipboardformat: | "CF_HPOBJ" (user defined)

The DDE commands CONNECT, POKE and REQUEST are supported.

The structure of the clipboard format "CF_HPOBJ":

4 Byte (length of object, LSB first) | HP object (normal HP object)

# 14. Emu48+ Changes

Emu48+ is a modified version of Emu48 to add support for the ARM-based calculators. It does not emulate the ARM CPU, but it enhances the Saturn emulation to more closely match the emulation provided by the Saturn emulator on the ARM-based calculators.

Emu48+ adds support for many of the Saturn+ instructions, including some of the BUSCC instructions, and it also adds support for the 80-line display used on the 49g+ and 50g.

At present, the additional calculators supported in Emu48+ are the 49g+, 48gII (hardware revision 1), 50g, and 39g+/39gs/40gs.

To create KML scripts for the additional calculator models, use the following model codes:

39g+/39gs: | Model "P" Class 39
40gs: | Model "P" Class 40
48gII: | Model "2"
49g+: | Model "Q"
50g: | Model "Q" Class 50

Most of the code that was changed in Emu48+ over Emu48 was provided by Cyrille de Brebisson of Hewlett-Packard.

# 15. License

Emu48 - A HP38G/39G/40G/48SX/48GX/49G Emulator
Copyright (C) 2025 Christoph Gießelink

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.