For years, we all assumed that PCjs meant Personal Computers in JavaScript. Even I thought that. But now it turns out that it also stands for Programmable Calculators in JavaScript. Who knew?

My first programmable device was a TI-57 Programmable Calculator, purchased in 1978. I (or more likely my dad) bought it at Radio Shack, so it was actually an EC-4000, but as I explain on the TI-57 Resources page, the EC-4000 was just a rebranded TI-57. I’m not sure why we bought it at Radio Shack. Maybe they were having a sale, or maybe we got a bunch of free punches on our Radio Shack Battery Cards.

It was a great device and I wrote all sorts of programs for it, although my fascination with it was eventually superseded by the Challenger 1P I got later that year.

I recently unearthed my TI-57 from storage, and after retro-fitting it with a 9V battery, I was happy to see that it still mostly worked, except for a few unresponsive buttons. I immediately started wondering how much work it would be to write a TI-57 emulator, to sidestep these annoying problems with fussy old hardware.

It was no real surprise that several other people already had the same idea, but as far as I could tell, only one person, who goes by the name “HrastProgrammer”, went all-out and created a simulation of the TI-57 calculator chip, the TMS-1500: basically, a very simple CPU with 20+ registers, along with 2K of ROM and assorted circuitry for driving the LED display and scanning the keyboard.

This was an interesting challenge, because while no system manuals had ever been published for this “single-chip computer”, it was documented in excruciating detail in at least nine TI-57 Patents. And excruciating is the right word, because only a hard-core chip designer would love reading the many delightful pages of how OR gate 515 is responsive to the DISP and REL HOLD signals or how NAND gate 468 is responsive to the MSKΦ signal from gates 220 received via inverter 434.

HrastProgrammer’s work was a great step forward, proving that an emulator was possible, and other people used it to learn more about TI-57 internals. For example, Claus Buchholz wrote a few articles (“The TI-57 Memory Map” and “TI-57 Constant ROM”) with the assistance of that emulator.

Sadly, HrastProgrammer’s work is closed-source, so many of the details that he gleaned from the patents and learned along the way remain buried. His FAQ summarizes his opinion of open-source projects:

Yes, what about it? From time to time, I receive a request to release them as open-source.
Sometimes it sounds like I SHOULD DO THIS because it is to be expected. Well, I SHOULD do
only what I WANT to do. And I DON'T WANT to release anything as open-source because I have
no reason to do this. Except in a few rare cases, I don't like this open-source concept at all
so I will not participate. All my emulators will be closed-source forever. Don't waste your
and my time asking such questions.

We know from a handful of blog posts that HrastProgrammer originally decided to use a hand-edited version of the TI-57 ROM, extracted from six TI patents, and that he probably made a number of useful corrections and discoveries along the way. However, in the most recent version of his TI-57E emulator, he uses an electronic dump of a production TI-57 ROM, reportedly obtained from a friend and which he said he could not distribute.

UPDATE: With a Windows debugger and lots of patience, I was able to isolate and extract the electronic ROM dump stored inside HrastProgrammer’s TI57E.EXE binary. See the TI-57 ROM page for details.

My only choice was to go down the same road that HrastProgrammer travelled and pore over the same TI patents. They are definitely valuable historical documents, filled with detailed diagrams, instruction decoding tables, and object code listings of the chip’s entire 2K ROM. Unfortunately, as several people before me had found, the ROM listings in nearly every one of the nine patents were all slightly different, no doubt because they had all been typed by hand (with one possible exception). Given all the obvious errors (invalid digits, excessive digits, and missing digits), it was all but certain that the listings also contained numerous non-obvious errors.

One enterprising person, Sean Riddle, had carefully scrutinized the ROM circuits of a Decapped TMS-1500 Chip and created a “transcript” of all the ROM bits. To get some idea of how tedious that process is, here’s a small section of that ROM image:

TI-57 ROM Image

So, how to be sure that that transcript was accurate? I decided to make my own independent transcript of all 26,624 ones and zeros, and then compare the results:


As my TI-57 ROM page explains, I found 4 bits that differed. I passed the corrections on to Sean, and then decided to go with this new transcribed ROM as the basis for my own emulator.

What you see below is the current state of the PCjs TI-57 emulator. Just today, I finished “wiring” up the LED and Keyboard devices to the TMS-1500 Chip device, and so far, basic arithmetic operations look good. I’ve not exercised it much beyond that, because I’m not ready to go down more debugging rabbit holes just yet. But if it does crash, there’s a handy “Diagnostics” window attached to it that should display useful information about what went wrong, and it even includes a “mini-debugger”.

With the PCjs TI-57 emulator, I also decided to take a fresh approach. Instead of using the same old ES5-based PCjs shared modules, the TI-57 emulator is built with a new set of ES6-based Device modules, including:

Since I’m not currently “compiling/transpiling” any of that code to ES5 (as I’ve done with every other PCjs machine to date), you have to be running a modern web browser. I’ll probably add an ES5 fall-back mechanism eventually, but for now, it’s rather refreshing to be using modern JavaScript language features and not constantly worrying about backward-compatibility.

Nov 5, 2017

TI-57 Calculator