The circuit consists of the i4004 microprocessor, two i4001 ROM chips with the calculator program, one i4002 RAM chip to store the operands and result value, and some discrete interface logic with the input switches. However, no display is provided in this applet. Please open the memory editor window of the i4002 RAM chip to read-off the input operands and the final result value. Obviously, a 'real' calculator would include a (multiplexed) seven-segment display and more functions.
The program running on the i4004 implements a simple binary-coded decimal pocket-calculator with just two operations: addition and subtraction. After the applet has loaded, simply click the input switches to type in the first argument number, next type in the operand, type in the second argument, and finally type the enter key. The program now calculates the result value.
Please open the memory editor of the i4002 RAM chip to watch the program execution. The register banks 0 and 1 are used to store the BCD numbers of the first and second arguments, while register bank 2 is used to store the operation result.
The calculator program is stored in two i4001 ROM chips. One ROM chip is loaded with the binary code corresponding to the assembly source file input.asm. It polls the pressed keys, stores the numbers in the RAM, clears the RAM banks and calls the calculation subroutine.
The second ROM holds the routines for addition and subtraction, based on this assembly source file: calc.asm. For a detailed description of the program operation, please see the original BSc. thesis, pages 38-46 (see link below).
Run the applet | Run the editor (via Webstart)