Documentation for Busicom 141-PF Simulator with Animated Flowchart

Software written by Fred Huettig
Conceptual design by Tim McNerney

Bug reports/comments to: busicom at starboarddesign dot com

Introduction

This is a simulation of the Busicom 141-PF printing calculator, the first embedded application firmware ever written for a commercial off-the-shelf (COTS) microprocessor, the Intel 4004. At the time that the 4004 and this software were being developed, Texas Instruments was developing a calculator chip of their own. The distinction between Intel's microprocessor and TI's calculator-on-a-chip, was that TI's chip could only be a four-function calculator, whereas the Intel 4004 could, by changing the off-chip ROM, be programmed to serve a wide variety of applications.

This simulator is running the actual code that was inside the Busicom ROMs extracted with the help of the Computer History Museum. This code runs on a 4004 instruction-level simulator written in C++.

When the user presses a key, the flowchart display shows the path that the calculator code takes to do a calculation. These are not native 4004 instructions, but rather they are "byte codes" executed by an interpreter implemented in 4004 machine language. Single-byte opcodes call into the calculator's primitive arithmetic library. Two byte instructions implement conditional branches. The interpreter does not support subroutine calling, so the entire calculator can be thought of as a giant "finite state machine" (FSM). The way that the calculator was implemented, using this "virtual machine" architecture is a form of data compression ("code compression" really). This allowed the whole calculator application to be implemented using only 1,024 bytes of ROM (1,280 bytes of ROM including the optional Square Root function). Yes, you read this right. The whole four-function calculator application fits in 1k bytes, including the keyboard scanner and print driver. The calculator had only 80 bytes of data RAM.

Installation / Instructions

This is a 1970's style Adding Machine not a modern Calculator!

The electronic calculators that accountants used 35 years ago worked differently than the familiar four-function calculator we use today. These were designed to behave much like mechanical adding machines of the 1960's. After every number you want to add to the total, you need to press +, so = doesn't work like you'd expect. Here are some examples:

Notice the "radio buttons" at the top of the keyboard. These set the number of digits after decimal point. If you set it to "0" you will only see integer results. The other three buttons set the rounding mode. OVF is the overflow error light. If you see this checked, you will need to press "C" to clear the error, or nothing will seem to work after that. NEG means the current total or the number you are entering is negative. The original calculator printed using both red and black ink, but this simulator doesn't. The "S" key is the "change sign" +/- key used for entering negative numbers. M means there is something in memory.

This is a printing calculator. The original Busicom 141-PF didn't have a display. The simulator doesn't have a display. Accountants back then didn't mind much. They'd be looking at the document with the numbers they were working with, much like professional touch typists. Nowadays all calculators have a display, so it might feel disconcerting that you can't see the number your are entering on the keypad until you press a function key like +.

Command-line arguments

These are the current command-line arguments, you can either type these at a DOS prompt or create a shortcut to the executable and add these to the "target" field of the shortcut properties.

The defaults are -f512, -c740, and monitoring 'off.'

-m and -v together will give you the ability to see what the interpreter is doing, and each line of the output file "4004out.txt" is marked with a cycle number so you can get the timing of each VM instruction.

Known issues

  • This software only runs under Microsoft Windows. It has only been tested under Windows XP. Members of the Mac OS and Linux community, please accept our apologies. In the future we may make this simulator available under other operating systems.
  • The printer window and the keyboard window always stay on top even when another application is selected.
  • Don't click on the "X" (close window) button in the upper right corner. It won't exit the program. Click on "Quit" instead.