Things used in this project
Update: since putting this project up here I have learned that all pins on the Due can be accessed as digital inputs (even analog inputs and other pins). This greatly simplifies the hardware setup for the Due, so I have adjusted the instructions here to use the simpler setup. Anyone needing access to the original instructions can find them by looking at previous revisions of the Documentation.pdf file in the Git repository or by contacting me in the comments.
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 64K 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 Altair 4K BASIC (the first Microsoft product), Altair extended BASIC, MITS Programming System II (Due only), Pong etc.
- BASIC and Assembler example programs are included in the emulator software and can easily be loaded into BASIC/Assembler.
- Emulates one serial device of an ALTAIR 88-2SIO serial board with control channel at 10h and data channel at 11h. This device is mapped to the Arduino’s serial input/output. To use, connect a serial terminal to Arduino RX/TX pins at 9600 baud 8n1. Does some special processing (based on memory location of IN/OUT operations) to simplify interaction with ALTAIR BASIC. 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.
- Data sent to the serial device can be captured and replayed (as if a Teletype terminal with paper tape reader/puncher was connected) on up to 256 virtual paper tapes.
- Emulates a cassette interface at I/O addresses 06h and 07h. There are 256 virtual tapes that can be used for storage.
- The cassette interface also 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.
- 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.
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)
- 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!