-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The goal of the cloud-connected Altair project is to provide a unique blend of computing history with modern cloud computing. You'll learn about computing fundamentals, software development, and modern IoT, Data, and AI cloud services that address today's real-world IT challenges.
The Altair 8800 kick-started the personal computer revolution. Microsoft's first product was Altair BASIC written for the Altair 8800 by Bill Gates and Paul Allen. At the time, Altair BASIC was a huge step forward as it allowed people to write programs using a high-level programming language.
The Altair project can run standalone and is a fantastic safe way to explore machine-level programming, Intel 8080 Assembly programming, along with C and BASIC development.
Optionally, the project integrates free weather and pollution cloud services from Open Weather Map, along with Azure IoT Central, and Azure Anomaly Detection Cognitive Service. The following reports were generated from data published by the Altair emulator using data sourced from Open Weather Map.
IoT Central Sydney pollution report | Azure Anomaly Detection report |
---|---|
Navigate the wiki sidebar documentation starting with the Introduction to the Web Terminal page. All the source code is provided under an MIT License, and contributions are very welcome.
This project is based on the Azure Sphere Cloud-Enabled Altair 8800 as featured on the Register "Microsoft adds cloud enablement to 1970s Altair 8800 tech".
The easiest way to try the Altair emulator is from your web browser. Select the following link, Test Drive the Altair 8800 emulator, and open the link in a new browser tab. The Altair web terminal will open, select Connect to start a 30-minute session. The web terminal connects to an instance of the emulator running in an Azure Container Instance.
Then learn about CPM, software development with BASIC, C, and Assembly using climate data sourced from Open Weather Map. Or take a break, and fire up a retro game.
The following limitations apply to test-drive:
- You'll lose any changes you make when you disconnect or close the test-drive web terminal.
- Only one person at a time can connect to the test-drive emulator. If you can't connect, then try again in 30-minutes.
The Altair emulator runs on desktop and device operating systems. The source code is the same, but on devices there are some extended experiences. The Altair emulator has been tested on the following desktop operating systems and devices.
The fastest way to run the Altair emulator is on your computer. The Altair emulator runs on POSIX compatible operating systems including, Linux, Windows with WSL 2, macOS on Apple Silicon and Intel.
The more interesting way to run the Altair emulator is on a device, the Altair emulator has been tested on the following devices:
- Raspberry Pi, models, Zero 1 & 2, 2B, 3B, 3B, and 4 running Raspberry Pi OS.
- Azure Sphere Avnet and Seeed Developer Kits running embedded Linux.
If you pair a Raspberry Pi with a Pi Sense HAT, the Altair address and data bus activity is displayed on the 8x8 LED panel.
Raspberry Pi with Pi Sense HAT | Raspberry Pi Sense HAT |
---|---|
The Altair emulator is supported on Azure Sphere devices from Avnet and Seeed Studio. If an Azure Sphere device is paired with the Altair front panel kit or the Mikroe Altair Retro Click, the Altair address and data bus activity is displayed.
Azure Sphere with the Altair front panel kit | MikroE Retro Click |
---|---|
Altair 8800 image attribution - Smithsonian Museum
The Altair 8800 was built on the Intel 8080 CPU, the second 8-bit microprocessor manufactured by Intel in 1974. By today's standards, it's a simple CPU design, perfect for learning computing fundamentals because of its small instruction set.
The original Altair 8800 was programmed by setting switches on the front panel. It was a painstaking, error-prone process to load and run a program. The Altair 8800 had a series of LEDs and switches that you used to load apps and determine the state of the Altair.
You could save and load applications from a paper tape reader connected to the Altair 8800. As the Altair 8800 grew in popularity, more options became available. You could attach a keyboard, a computer monitor, and finally disk drives, a more reliable way to save and load applications.
Starting from the bottom left and moving up and then to the right.
- POSIX Compatible OS:. The Altair 8800 emulator runs on POSIX compatible operating systems, including Linux, macOS, Windows WSL 2, and Raspberry Pi OS.
- WebSocket & Azure IoT C: These communication libraries connect the Altair emulator to the web terminal and cloud services. The Altair terminal IO messages are routed over WebSockets, and the Azure IoT C SDK connects the Altair to Azure IoT Central.
- Event library: The Altair coordinates activities on the main thread using the event event loop library.
- EdgeDevX: This library simplifies access to Azure IoT services, provides event-timer services, along with several useful utilities.
- Terminal IO & Cloud Services: The Intel 8080 CPU provides 256 input ports and 256 output ports. The Intel 8080 ports were used to integrate peripherals such as disk drives, printers, and modems. However, for the Altair emulator, these ports are used to integrate communications and cloud services. Terminal input and output ports are routed over WebSockets, other ports are used for timing services, access to weather and pollution data, plus Azure IoT services.
- Intel 8080 emulator: This is an open-source software implementation of the Intel 8080 CPU. The Intel 8080 emulator executes Intel 8080 applications including the CP/M operating system, compilers, apps, and games.
- CPU Monitor: The CPU monitor implements the virtual Altair front panel, along with memory disassembler, tracer, and Altair emulator reset.
- CP/M: CP/M originally stood for Control Program/Monitor. Later, CP/M became known as Control Program for Microcomputers. It was a mass-market operating system created in 1974 for Intel 8080/85-based microcomputers by Gary Kildall of Digital Research, Inc.
- Programming languages: Included on the main disk image are the Microsoft BASIC interpreter, the BDS C compiler, and the Intel and Microsoft assemblers and linkers.
- Altair BASIC: By default the Altair emulator boots CP/M, but it is easy to boot the original Altair BASIC program.
- Altair Web Terminal: Provides a web-browser hosted Altair terminal. The web terminal is built using the Xterm library. Xterm.js provides a web browser-hosted terminal, a WebSocket integrates Xterm with the Altair emulator.
- Open Weather Map: Open Weather Map provides planet-scale weather and pollution data services. Open Weather Map provides free access to weather and pollution data by geographic location.
- Azure IoT Central: Azure IoT Central is a customizable cloud-based Internet of Things (IoT) application platform. You can report, analyze, and export IoT data.
The Intel 8080 CPU can address up to 256 input ports and 256 output ports; allowing for virtually unlimited system expansion. Access to the ports is via the IN and OUT Intel 8080 CPU instructions.
The Altair emulator uses Intel 8080 IO ports to provide time services, true random numbers, and access to cloud services.
- You can access Intel 8080 IO ports from BASIC, C, Assembly programming languages, and directly using Intel 8080 opcodes. See Using Intel 8080 Input Output ports.
- The Intel 8080 software-enabled IO ports are implemented in the io_ports.c file.
- You can extend the Altair 8800 by adding additional IO port functions, for example, integrating machine learning capabilities.
The following tables shows output port numbers and port data values. Typically, calling an output port will load data to be read via an input port.
Port | Port data | Loads |
---|---|---|
29 | 0-255 | Set timer period in milliseconds |
30 | 0-255 | Set timer period in seconds |
33 | ASCII | CopyX filename |
41 | 0 | System tick count |
42 | 0 | Current UTC date and time |
43 | 0 | Current local date and time |
44 | 0 | Generates a random number between -32000 and 32000 |
Port | Port data | Loads |
---|---|---|
34 | 0 | "Celsius" string literal |
34 | 1 | "Millibar" string literal |
34 | 2 | "Humidity %" string literal |
34 | 3 | "Wind km/h" string literal |
34 | 4 | "Wind degrees" string literal |
34 | 5 | "Observation" string literal |
35 | 0 | Temperature (Note 1) |
35 | 1 | Pressure (Note 1) |
35 | 2 | Relative humidity (Note 1) |
35 | 3 | Wind speed (Note 1) |
35 | 4 | Wind direction (Note 1) |
35 | 5 | Weather observation (Note 1) |
Port | Port data | Loads |
---|---|---|
36 | 0 | "Latitude" string literal |
36 | 1 | "Longitude" string literal |
36 | 2 | "Longitude" string literal |
36 | 3 | "City" string literal |
37 | 0 | Latitude (Note 2) |
37 | 1 | Longitude (Note 2) |
37 | 2 | Country name (Note 2) |
37 | 3 | City name (Note 2) |
Port | Port data | Loads |
---|---|---|
38 | 0 | "AQI(CAQI)" string literal |
38 | 1 | "CO" string literal |
38 | 2 | "NO" string literal |
38 | 3 | "NO2" string literal |
38 | 4 | "O3" string literal |
38 | 5 | "SO2" string literal |
38 | 6 | "NH3" string literal |
38 | 7 | "PM2.5" string literal |
38 | 8 | "PM1.0" string literal |
39 | 0 | Air quality index (Note 1) |
39 | 1 | Carbon monoxide level (Note 1) |
39 | 2 | Nitrogen monoxide level (Note 1) |
39 | 3 | Nitrogen dioxide level (Note 1) |
39 | 4 | Ozone level (Note 1) |
39 | 5 | Sulphur dioxide level (Note 1) |
39 | 6 | Ammonia level (Note 1) |
39 | 7 | Particulate matter 2.5 level (Note 1) |
39 | 8 | Particulate matter 1.0 level (Note 1) |
Port | Port data | Loads |
---|---|---|
31 | ASCII | Publish JSON to IoT Hub/Central (Max 256 characters) (Note 3) |
32 | 0 | Publish weather and pollution data to IoT Hub/Central (Note 3) |
Port | Port data | Loads |
---|---|---|
60 | 1 or 0 | Turn Red LED on or off |
61 | 1 or 0 | Turn Green LED on or off |
62 | 1 or 0 | Turn Blue LED on or off |
63 | 0 | Loads onboard temperature |
63 | 1 | Loads onboard pressure |
Port | Port data | Loads |
---|---|---|
80 | 0, 1, 2 | 0 = Bus mode, 1 = Font mode, 2 = Bitmap mode |
81 | 0, 1, 2 | 8x8 LED Panel RGB color. 0 = Red, 1 = Green, 2 = Blue |
82 | 0..255 | Set 8x8 LED Panel Red palette |
83 | 0..255 | Set 8x8 LED Panel Green palette |
84 | 0..255 | Set 8x8 LED Panel Blue palette |
85 | 0..255 | Display ASCII character |
Typically, input ports will read data loaded by an output port.
Port | Description |
---|---|
29 | Query milliseconds timer status. Enabled or expired (true or false) |
30 | Query seconds timer status. Enabled or expired (true or false) |
31 | Query publish json pending status. Enabled or expired (true or false) |
32 | Query publish weather pending status. Enabled or expired (true or false) |
33 | CopyX end-of-file (true or false) |
200 | Read loaded byte stream |
201 | Read CopyX file stream |
Notes.
- Requires an Open Weather Map API Key, and an active internet connection.
- Requires an active internet connection to call the geojs.io web service.
- Requires an active internet connection and a free or paid tier or Azure IoT Central.
The following code snippets use the Intel 8080 IO ports. The code samples included on the CP/M boot disk expand on these snippets.
The following assembly code demonstrates the use of the Intel 8080 IO port 30 timer. The code sets a 2 second delay, and then waits for the timer to expire. This is a snippet of the SLEEP.ASM sample included on drive B: of the Altair emulator.
ORG 0100H ;CP/M base of TPA (transient program area)
MVI A,2 ;Move 2 to the accumulator to set a 2 second delay
OUT 30 ;Start timer
LOOP: IN 30 ;Get delay timer state into the accumulator
CPI 00H ;If accumulator equal to 0 then timer has expired
JZ BACK ;Jump on zero
JMP LOOP
BACK: RET
The following C code demonstrates the use of the Intel 8080 IO port 30 timer. The code sets a 1 second delay, and then waits for the timer to expire. This is a snippet of the HW.C sample included on drive B: of the Altair emulator.
outp(30,1); /* Enable delay for 1 second */
while(inp(30)); /* Wait for delay to expire */
The following BASIC code demonstrates the use of the Intel 8080 IO port 30 timer. The code sets a 1 second delay, and then waits for the timer to expire. This is a snippet of the COUNT.BAS sample included on drive A: of the Altair emulator.
900 REM This sleep subroutine sleeps or delays for 1 second
1000 OUT 30, 1
1100 WAIT 30, 1, 1
1200 RETURN
The following BASIC code demonstrates the use of Intel 8080 output port 35 to load the current temperature, and input port to read the temperature. This is a snippet of the WEATHER.BAS sample included on drive A: of the Altair emulator.
500 PORT = 34 : REM Set the output port number
510 PDATA = 0 : REM Set the port data value to 0 for temperature
520 GOSUB 4800 : REM Loads the temperature and then reads the temperature string
530 PRINT RSTRING$
540 END
4800 REM SUBROUTINE READS STRING DATA FROM PORT UNTIL NULL CHARACTER
4900 OUT PORT, PDATA
5000 RSTRING$ = ""
5100 C=INP(200) : REM Read the temperature character by character until NULL returned
5200 IF C = 0 THEN RETURN
5300 RSTRING$ = RSTRING$ + CHR$(C)
5400 GOTO 5100
The following example shows how to use the Intel 8080 IO ports to display characters on the Pi Sense HAT or Retro Click 8x8 LED panels. To understand IO ports, refer to the io_ports.c source code. This example is included on drive A: in a file named FONT.BAS.
100 REM 8x8 LED Panel Demo
200 OUT 80,1 : REM Flip the 8x8 LED panel to FONT mode
300 FOR J = 1 TO 10
400 FOR I = 33 TO 122
500 OUT 81, I MOD 3 : REM Cycle font color
600 OUT 85, I : REM Display character on the 8x8 LED panel
700 PRINT CHR$(I)
800 OUT 29, 250 : WAIT 29, 1, 1 : REM Pause for 250 milliseconds
900 NEXT I
1000 NEXT J
1100 OUT 80,0
The following example shows how to use the Intel 8080 IO ports to blink LEDs on an Azure Sphere. To understand IO ports, refer to the io_ports.c source code.
5 OUT 80, 1 : REM switch display to font mode
10 WHILE 1=1 : REM Loop forever
20 OUT 60, 1 : REM switch on the red LED
30 OUT 29, 250 : WAIT 29, 1, 1 : REM delay 250 milliseconds
40 OUT 61, 1 : REM switch on the green LED
50 OUT 29, 250 : WAIT 29, 1, 1 : REM delay 250 milliseconds
60 OUT 62, 1 : REM switch on the blue LED
70 OUT 29, 250 : WAIT 29, 1, 1 : REM delay 250 milliseconds
80 OUT 60, 0 : OUT 61, 0 : OUT 62, 0 : REM Turn off all LEDs
85 OUT 29, 250 : WAIT 29, 1, 1 : REM delay 250 milliseconds
90 WEND
100 OUT 80, 0 : REM switch display to bus mode