Intel 4004 and 4040 4-bit processor development kit
with Busicom 141-PF calculator emulation
Last Update: 10/03/2021
user manual in PDF (so far in CZ, working on EN version)
AT4004 on GitHub: https://github.com/Panda381/AT4004
The AT4004 is a development and tutorial kit used to provide a basic introduction to programming the Intel 4004 and 4040 4-bit processor. The processor is simulated in real time using the ATmega8 processor, timed by an internal 8 MHz oscillator. The kit includes an emulation of the Busicom 141-PF calculator. Emulated programs can be compiled either as part of the built-in ROM of the ATmega8 processor, or edited by writing directly to the internal EEPROM memory in the built-in editor. From the emulated program, the 4-bit input and output ports can be accessed, brought out to both the CANON 9-pin connector and the built-in buttons and LEDs. It is also possible to access the other buttons and the character LCD display.
A ROM memory of 14 pages of 256 bytes (3584 bytes at addresses 0x000 to 0xDFF) and an EEPROM memory for direct program editing of 2 pages of 256 bytes (512 bytes at addresses 0xE00 to 0xFFF) are available for the emulated program. As RAM, the emulated program has 5 memory banks, that is a total of 1600 digits or 800 bytes. The kit can be powered via a USB cable either from the computer's USB connector or from a USB +5V charger.
The Busicom 141-PF calculator (the UniCom 141P was the OEM version) was developed in 1971 and was based on the Intel 4004 processor, which was developed by Intel for this purpose. The processor operated with a clock frequency of 740 kHz and instruction times of 10.8 and 21.6 us. The calculator did not contain a display but a printer with a rotary print drum and a print width of 18 characters. The calculator could display up to 14 floating-point digits and internally calculated to 16 digits.
Note: Click to enlarge images
The USB connector is only used to power the kit from an external +5V charger or from the USB port. The processor uses an internal 8 MHz RC oscillator. Outputs from the processor are connected to the LEDs via 2K2 resistors and to the port via 470 resistors. The values of the resistors for the LEDs may need to be adjusted to the luminosity of the LEDs used. The input pins of the port are connected in parallel to the buttons. If you connect output signals to the port, do not use buttons for the inputs to avoid shorting the connected outputs. Resistor R1 controls the bias voltage for the display contrast. You may need to change it to a different value for a different display, typically 1K is better for some displays. Resistor R2 controls the intensity of the display backlight.
The circuit board has a size of 100 x 75 mm and the free version of Eagle can be used to design it. I make the PCB using photo path from photocuprextit, here just one side is sufficient. Micro switches without additional fingerboard are used as buttons. A paper label with button labels and button holes cut out can be folded over the buttons. The processor is plugged into a DIP28 socket, this allows for easy replacement when replacing an emulated ROM version or when damaged through ports. The LCD is connected to the board via a pin and pinhole rail and can thus be easily removed. The surface joint is ready for both a 5.7 mm and 8 mm high pinhole rail.
Bottom side of the PCB:
Top side of PCB - can be replaced with 4 wires:
Printing on the PCB:
Pillars are screwed into the corners of the board, serving as feet:
Mounted plate, printing is on paper glued on the PCB and covered with adhesive:
The display is connected via a corner pin rail:
The assembly, on top the display is held by a pin rail, on the bottom it is screwed to two M3 x 8mm pillars:
You can see from the worn corners of the printing paper that the kit has been worked a lot and is now tired :-D :
The labels for the buttons are printed on an inkjet printer on plain paper, taped on both sides and then the holes for the buttons and LEDs are cut with a 4 mm cut-out (the first label is for the programming mode, the second for the Busicom 141-PF calculator emulation):
When programming the firmware into the ATmega8 processor it is necessary to set the processor fuses as follows: LOW = 0xE4, HIGH = 0xD1 (the processor works with the internal 8 MHz RC generator). Be careful if you use a processor from another device switched to an external crystal - in this kit (without crystal) it may not be possible to program it, it may be necessary to connect a crystal externally to the processor. This does not apply to a new unused processor, this is always switched to the internal RC oscillator.
The display backlight should light up when power is connected:
When the processor and display are working properly, the opening text should appear for less than a second. If the text is not visible, you may just need to lower the display contrast resistance R1 from 2K2 to 1K0:
How to use the kit
When you turn on the AT4004 kit, the programming edit mode will start (in the photo with the programming button label on).
In the programming mode it is possible to view the emulated program in ROM memory (address 0x000 to 0xDFF) and edit the program in EEPROM memory (address 0xE00 to 0xFFF). The first row of the display shows the 5 bytes of memory around the current address. The byte from the current address is delimited by slash brackets. The second row of the display shows the contents of the current address: the address, the contents of the address in HEX code, and the simplified mnemonic of the instruction (without parameters).
The program can be scrolled through with the SST (step forward) and BST (step backward) buttons. Scrolling is byte by byte, not instruction by instruction. The GTO button can be used to jump to a specified address. The address entry can be interrupted by pressing e.g. SST or BST. When editing a program in EEPROM (addresses 0xE00 to 0xFFF), a new byte value is written by entering 2 HEX digits. The entry can be interrupted by pressing e.g. SST or BST. The program can be started either from the current address with the 2ND RUN button or from the beginning of 256B page 0..15 with the 2ND RUN0 to RUNF buttons. The started program is interrupted by pressing RESET. The 2ND button selects an alternative button function. DEL and INS delete or insert a byte at the current address, but only within the range of the current 256B page.
Busicom 141-PF calculator emulation
To start the Busicom 141-PF calculator emulation after switching on the kit, press the 2ND RUN buttons (start from the current address 0) or press 2ND RUN0. The display of the kit emulates the output to the printer and so the data appears only after some operation has been performed.
LED indicators: M (yellow) is non-zero memory content, OVF (red) overflow, NEG (green) negative result.
The sum of '+' and the difference '-' is working with the accumulator. First enter the number and then the '+' or '-' operation to be performed on the number. Finally, the accumulator contents are displayed with '='. For example, you would enter '3 - 2 =' as '3 + 2 - ='.
When multiplying by 'x' and dividing by ':', follow the same procedure as with current calculators, e.g. "2 x 3 =".
Press the calculator buttons slowly, about 2 presses per second maximum, otherwise some presses may be lost (the keyboard operation is slow).
The setting of the number of decimal places and the rounding mode will only become apparent the next time the result is output. The 'FL' (floating) rounding mode will display the number with maximum precision with the removal of insignificant zeros, but will only appear for multiplication and division. '54' mode rounds the result, 'N' mode disables rounding. 'DP0' to 'DP8' sets the number of decimal places to 0 to 8.
'C' clears everything (except memory), 'CE' clears a wrong entry. 'S' is used to enter a negative number. 'SUB' displays the intermediate result of addition and subtraction. 'EX' swaps registers during multiplication and division. 'CM' displays memory and clears it. 'RM' displays memory and keeps it. 'M+' and 'M-' add or subtract a number from memory. 'ADV' is paper shift (line feed).
The sample programs can be compiled using the included AS4 compiler. From the compilation listing, write the HEX codes into the EEPROM memory of the kit and run the program. The source codes for the sample programs can be found in the AT4004 firmware source code.
Example 1 - copy input to output
Write the program from address 0xE00 and run it with the 2ND RUNE buttons. Pressing the IN0..IN3 buttons will light the LEDs on OUT0 to OUT3.
E02 20 30
E07 20 40
E0B 4E 02
Example 2 - Flashing with LED
Write the program from address 0xE80 and run with the GTO E 8 0 2ND RUN buttons. The LEDs will flash alternately with a delay of 250 ms.
E82 20 40
E87 5E 97
E8B 5E 97
E8F 5E 97
E93 5E 97
E95 4E 85
E97 22 D5
E99 24 6F
E9B 75 9B
E9D 74 9B
E9F 73 9B
EA1 72 9B
Example 3 - text display
Write the program from address 0xF00 and run it with the 2ND RUNF buttons. The display shows the text.
F00 22 40
F05 22 60
F08 20 18
F11 1C 14
F14 73 0A
F16 4F 16
Wiring diagram in Eagle Free
4004 processor and 141-PF calculator documentation
AT4004 kit User Manual (so far in CZ, working on EN version)
Graphic documents (schematic and PCB)
Source codes and firmware of the AT4004 kit
Utility, AS4 compiler
Total price for all 335 CZK (without PCB).