Things used in this project
For a long time I have thought it would be cool to have an Altair 8800 computer to play around with. But working vintage Altairs are rare and therefore expensive, easily costing $1500-$2500 if available at all. There are some other options, such as altairclone.com but that still costs $600 which for me is too much to spend on a computer that - while very cool - will be of limited use.
At some point I was looking at the Arduino Mega 2560 specs and started wondering whether it would have enough I/O pins to just hook up the LEDs and switches from the Altair front panel and write my own emulator software. Turns out the Arduino Mega has exactly the right number of I/O pins. So I just had to make my own Altair clone.
Using the Arduino Mega to drive the simulator worked fine and was simple to set up but the emulation runs at only about 25% of the Altair's speed and it can only provide 6KB of emulated RAM (although back in the day that would have been a lot). Permanent storage capacity (for saving programs/data created in the simulator) is also limited since the Mega's EEPROM only holds 4KB.
The Arduino Due has plenty of memory to support a full 64KB of emulated RAM and runs much faster than the Mega. Additionally, the Due can save data to the flash memory at run time. That makes it possible to use any portion of the 512K flash not used by the simulator itself for permanent storage.
Using the Due I now have an Altair 8800 simulator that runs at about the original speed, provides 64K of emulated RAM, includes lots of Altair software and still can provide 32K of semi-permanent storage to load and save programs and data in the emulator.
My goal for this project was to get as close to the "real" Altair 8800 feeling as possible when working with the simulator. That includes having the front panel lights reflect the real behavior as much as possible. One criterion for that was that it should be possible to play the front-panel "Kill-the-Bit" game - and it is:
It turns out that the simulation is true enough to the original that even the Altair 8800 music demo works. Note that this relies on an AM radio picking up the electromagnetic interference generated by the Altair's circuitry!
Of course in the end I don't own an original Altair, so all information on how it works had to come from documents and videos (see acknowledgements below). There may be some minor differences but over all I think it reproduces the original behavior quite well. One known (and intentional) difference is the HLDA status light: On the original it signals that CPU has acknowledged being halted by an external device. This functionality is never used in the simulator so here it signals that a file (serial/tape capture/replay) is currently open.
- Accurately reproduces the behavior of the Altair's front panel elements.
- Runs at about the same speed as the original Altair 8800 (when using Arduino Due) or 25% original speed when using Arduino Mega.
- Emulated RAM size is 64KB (Due) or 6K (Mega)
- A number of Altair programs are included and can easily be loaded into the emulator, including Pong, Altair 4K BASIC (the first Microsoft product), Altair extended BASIC, MITS Programming System II (Due only), Altair Time Sharing BASIC (allows multiple users to use BASIC at the same time).
- BASIC and Assembler example programs are included in the emulator software and can easily be loaded into BASIC/Assembler.
- Emulates one 88-SIO, 88-2SIO and 88-ACR (audio cassette recorder interface) board. Each simulated serial device can be mapped to an Arduino's serial interface. By default, the two most common (88-SIO and 88-2SIO port 1) are mapped to the Arduino's main serial port at 115200 baud 8n1, which can be accessed via the USB cable. I recommend connecting a serial-to-Bluetooth dongle to the RX/TX serial pins. That way any bluetooth-enabled device can serve as a terminal for the Altair.
- On the Arduino Due, both the main serial interface (USB) and the Serial1 interface (pins 18/19) can be used simultaneously.
- Data sent to each serial device (including the ACR tape) can be captured and replayed in up to 256 files which are kept in the Arduino's local storage (EEPROM or FLASH).
- The cassette interface supports using the CSAVE/CLOAD commands in extended BASIC (support is automatic with no user interaction required). Great for developing your own BASIC programs!
- Emulates up to 16 88-DCDD disk drives (4 in default configuration). Disk drive emulation is optional but requires hooking a SD card up to the Arduino's SPI header. Only supported when using Arduino Due.
- Emulates a 88-RTC-VI board with real-time clock and vector interrupt handling. This makes it possible to run Altair Time Sharing Basic.
- 256-byte pages of memory can be saved to permanent storage and loaded back to memory. This provides a simple way of saving programs entered via the front panel switches.
- Many settings can be easily changed via the integrated configuration editor.
When using the Due, be aware that everything captured or saved within the simulator gets erased if you upload a new version of the sketch to the Due. This is because saved data is stored in flash memory which gets erased when uploading a new sketch (the Due does not have any EEPROM for permanent storage). If an SD card is hooked up to the Due, saved data is stored on the SD card. In that case data will not get lost when uploading a new sketch.
Since the simulator works exactly the same as the Altair 8800, the original Altair's documentation (easily found on Google), will provide all the information needed to operate the front panel switches.
However, the simulator does include a number of extra functions and built-in software for the Altair which are accessible via the AUX1/AUX2 switches on the front panel (those were included but not used on the original Altair). That functionality is explained in a separate document which I wrote up while developing the software for the Simulator. The document is many pages long and the information contained in it would overwhelm this page, so please refer to the Documentation.pdf file in the source repository.
One goal was to use as little support circuitry as possible. Both the Arduino Mega and Due have enough I/O pins to directly wire up all the front panel elements. The only additional circuitry required are the transistors and resistors to drive the 36 LEDs (if the LEDs were connected directly to the Aruino's output pins and too many turned on at the same time the total current would exceed the Arduino's limits).
Creating full schematics for this project would be tedious, repetitive (36 identical LED driver circuits, wiring for 32 switches) and not very helpful. So the schematics document instead contains detailed tables about which elements get connected to which Arduino pins and the schematics for the individual sub-circuits (like LED drivers). I also added a Fritzing file to show the layout of the LED driver components on the stripboard.
To create the front panel I started with a high-quality scan of the Altair's front panel (found here at www.vintage-computer.com) and had it printed at a copy shop onto card stock. For the backing (to actually hold switches and LEDs in place) I used a sheet of 22 gauge metal, using a regular power drill to create the holes for LEDs and switches. The LED driver circuits are soldered on pieces of stripboard which are soldered directly to the LEDs which in turn are held in place by the metal sheet.
The front panel is held in place and upright by a simple wooden box. The box is not as deep as the original Altair (because it only has to hold the front panel and Arduino).
To wire up the front panel On/Off switch, I just added a power socket (same as on the Arduino itself) to the box, wired it to the front-panel switch and from there to a power plug that plugs into the Arduino.
When using the Arduino Due, emulation of up to 16 88-DCDD disk drives can be enabled by connecting an SD card to the Due's SPI port. The last page in the Schematics document shows required wiring in detail.
Before uploading the sketch to the Arduino Due, be sure to switch the Arduino compiler's optimization setting to "performance". By default it is set to "size" (not sure why since the Due has 512k flash memory). To do so, load file
into a text editor and change any occurrence of "-Os" to "-O3". You can skip this step but then the simulator will run significantly slower.
The simulator software can also run on a bare-bones Arduino (Mega or Due) without any front panel controls connected. This does allow to run quite a few of the included programs (those that mostly use the serial terminal and not the front panel elements). To do so, edit the
source file and set
#define STANDALONE 1
(instead of 0). Refer to the "Debugging capabilities" section in the documentation to see how to operate the virtual front panel elements in that setup. Keep in mind though that this is not the intended use of the simulator. I suggest using PC-based all-software emulators if you don't want to build the front panel hardware.
source file contains a number of switches that include/exclude simulator functionality. The default settings work well but if you want to tweak the simulator, this is the place to start.
Since I do not own an Altair myself, I had to rely on getting information off the internet. The Altair 8800 instructional videos produced by deramp5113 (Mike Douglas) of altairclone.com were of great help and are very interesting to watch. Also very helpful to get some ideas about what to do with the simulator.
While I did write all the code including the CPU emulation myself, I did take some inspiration from the i8080 core model project when it came to getting the half-carry computation and the DAA instruction implemented efficiently.
The simulator includes some original software for the Altair 8800. All of it can easily be found online, so I assume it is fine to include in the emulator:
- Altair 4K BASIC (MITS 1975)
- Altair Extended ROM Basic (MITS 1975)
- Altair Time Sharing Basic (MITS 1977)
- Kill-the-Bit game (Dean McDaniel, 1975)
- 'Daisy, Daisy...' music (Steve Dompier, 1975)
- MITS Programming System II (MITS 1976)
- Altair Turnkey Monitor (MITS 1977)
- i8080 CPU Diagnostic (Microcosm Associates, 1980)
- i8080 CPU Exerciser (Frank D. Cringle 1994, Ian Bartholomew 2009)
Arduino Altair 8800 simulator code
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!