Running CHIP-8 on an HP 48 calculator

7 minute read

How to use an advanced calculator as a “Game Boy” for CHIP-8!

In 1990, the 1977 programming language and interpreter CHIP-8 had its renaissance on the HP 48S, a graphing calculator that was common in engineering schools. The numeric keypad was well suited for CHIP-8 input, and the simple language made it easier to make small games to play in the classroom.

I recently purchased an HP 48GX to play CHIP-8 games on. The user manual is pretty hefty, so I thought I’d write a short guide on how to use CHIP-8 on a HP 48 calculator with no frills or maths.

What calculator to get

If you don’t already have a calculator, here are your choices and their differences (at least the ones relevant to us).

  • HP 48S: The original HP 48.
  • HP 48SX: Same as the HP 48S, but with expandable memory (both RAM and ROM) using special cards.
  • HP 48G: Faster CPU. Slightly better screen. Won’t necessarily run all HP 48S/SX programs.
  • HP 48G+: Same as HP 48G, but with 128 KB onboard RAM instead of 32.
  • HP 48GX: Same as HP 48G+, but with expandable memory (both RAM and ROM) using special cards.
  • hp 48gII: Don’t get this one. It’s not actually an HP 48, but an HP 49.

I recommend an HP 48G+ or HP 48GX, for the faster CPU and additional memory. If you find one that comes with a cable, that’s nice, as you’ll need it.

One thing you could look for is that some later 48G/GX/G+ models came with a better LCD screen with better contrast. You can tell by the color: Black pixels on gray background, as opposed to the usual blue pixels on green background. Here’s an hpmuseum.org forum thread with comparison pictures.

In the rest of this article, model-specific instructions will be denoted like this:

Information for HP 48S and HP 48SX will be orange.

Information for HP 48G, HP 48GX and HP 48G+ will be green.

Downloading a CHIP-8 interpreter

To play CHIP-8 games on your calculator, you’ll need an interpreter.

The TLDR summary on what to get is that you go to Chromatophore’s repository and download these files:

For the HP 48S or HP 48SX, download SCHIP and SCHPC (and maybe c48 if you want).

For HP 48G, HP 48GX or HP 48G+, download GCHIP and GCHPC.

Now for the historical background on these interpreters, which you can skip:

When CHIP-8 was first ported to the HP 48S in 1990, it was called CHIP-48. It won’t run on an HP 48G/GX/G+, but even if you have an HP 48S/SX, this interpreter is basically only an historical curiosity at this point.

Not long after (1991), SUPER-CHIP was released, which expanded CHIP-48 with some new capabilities (like four times the screen resolution). This is the one you want. It comes in two versions: SCHIP for HP 48S/SX, and GCHIP for HP 48G/GX/G+.

However, both CHIP-48 and SUPER-CHIP (SCHIP/GCHIP) are subtly incompatible with many CHIP-8 games written for other platforms. They’re not completely backwards compatible and can’t run all games from the 70s and 80s, for example. You can read more about these incompatibilies in Chromatophore’s excellent and detailed write-up. She also patched SCHIP and GCHIP to support these games, and these patched versions are called SCHPC (SUPER-CHIP Compatibility) and GCHPC, respectively. Of course, many actual SUPER-CHIP games won’t run on these… So it’s best to get both flavors.

Downloading CHIP-8 games

Here’s a couple of websites where you can find CHIP-8 games:

  • hpcalc.org has a bunch of games made specifically for the HP 48 (ie. the SCHIP/GCHIP interpreter)
  • chip8Archive has several CHIP-8 and SCHIP games (mostly for the SCHPC/GCHPC interpreter)

There are many other CHIP-8 games on the Internet, dating all the way back to 1977, but these ones should keep you occupied for a while.

Transferring files

Now you need to be able to transfer these files onto the HP 48. To do that, you need a special HP to serial cable. You can get a first party one online, but they’re not exactly cheap.

The second option is to make one yourself. This requires some soldering. I haven’t done this myself, as I got a cable with my calculator, but you can follow this How to Make a Serial Cable guide.

Unless you have a serial port on your computer (which you probably don’t), you’ll also need a serial to USB connector. They should be fairly easy to find. Here’s a pretty cheap one on Amazon.

Now hook up your calculator, and set it up to receive files.

Press I/O (PRG) and then press SETUP.

The setup should look like this:

When you're done, press I/O (PRG) again.

Press I/O (1) and choose "Transfer...".

The setup should look like this:

Now that the calculator is ready to receive, you can transfer files to it via the Kermit protocol. There are several programs online you can use.

For Mac and Linux, if you’re familiar with the command line, C-Kermit is probably the best bet. Use the following commands:

  SET PREFIXING ALL       ; (C-Kermit or Kermit 95)
  SET MODEM TYPE DIRECT   ; (C-Kermit or Kermit 95)
  SET PORT COM3           ; (Or other communication port)
  SET SPEED 9600          ; (Serial port speed)
  SET CARRIER-WATCH OFF   ; (Don't require carrier)
  SET FLOW NONE           ; (Don't use flow control)
  SET PARITY NONE         ; (8 data bits, no parity)
  SET BLOCK 3             ; (if desired, or 2)
  SET CONTROL PREFIX ALL  ; (Necessary in Kermit 95)
  SET FILE TYPE BINARY
  ROBUST                  ; (Might be needed for home-made cables)

For Windows, I ended up just getting the good old HyperTerminal. That program used to come with Windows all the way until Windows XP. It’s not included anymore, but you can find it online and run it fine on Windows 10 (it’s just an EXE and a DLL). Set up with the corresponding settings as on the calculator.

My cable appeared as serial port COM3 on my computer, but yours might differ.

Once everything is ready, press RECV on the calculator, and then send the file from the computer (with C-Kermit, type the command SEND followed by the filename). Boom! The file should appear on your calculator.

On HP 48G/GX/G+, you can also transfer files using the XMODEM protocol instead of Kermit. XMODEM is much faster than Kermit, but it doesn’t transfer the file name, so you will need to enter a file name on your calculator to receive it. (Kermit also supports ASCII files, while XMODEM only supports binary, but CHIP-8 games are binary anyway.)

Running CHIP-8 programs

On the home screen, you should see a list of all your files at the bottom, in small black boxes. These are the global variables on your HP 48. If you don’t see them, you can get them back by pressing VAR. If you have more variables than can fit on the screen, press NXT and PREV (NXT) to page through them.

To run a CHIP-8 game, first press the white top-row button (labelled A–F) underneath the game you want to run. This will push that variable onto the stack, and it should appear at level 1.

Then, press the button underneath the CHIP-8 interpreter (labelled SCHIP/GCHIP or SCHPC/GCHPC). This will run the interpreter, using the game at the top of the stack as its argument!

As you can see, the HP 48 is a stack-based calculator. You don’t need to think about that too much, but if you push the wrong thing to the stack, press to drop one object.

Press CLR () to clear the stack.

Press DEL to clear the stack.

Playing CHIP-8 games

The HP 48 doesn’t have a hexidecimal keypad, so the 16 keys in the bottom right corner are used. This means that some games made for other computers might prompt you to press a key that either doesn’t exist on the HP 48, or is located somewhere else. This is especially confusing for the number keys, which have moved around. In that case, you can refer to these images:

CHIP-8 keypad and corresponding keys on the HP 48GX

In addition, the following keys have special behavior:

  • ENTER restarts the current game
  • +/- toggles the sound (which is separate from the system-wide beeper setting…)
  • exits the CHIP-8 interpreter

Deleting CHIP-8 programs

Deleting files off the calculator isn’t straight forward.

First, press the ' key to enter text input mode. Then, press the button underneath the game you want to delete. The file name should appear in single quotes. Press ENTER to push the name onto the stack.

Finally, press PURG (DEL) to purge the variable.

Finally, press PURG (EEX) to purge the variable.

Making CHIP-8 games

Now, wouldn’t it be fun to make your own CHIP-8 games for your calculator?

Octo is an integrated high-level assembler, IDE and emulator that is easy to use. It also comes with several guides on how to write CHIP-8 games, and it can assemble the code into a binary file that you can load onto your HP 48.

Every year, in October, the Octojam game jam takes place, where enthusiasts get together to make CHIP-8 games. Join us!

Tags:

Categories:

Updated:

Comments