Meet the Altair · From switches to instructions

Entering your
first program.

We have supplied every program so far. This time, you will put the bytes into memory yourself, then watch the 8080 carry out the instructions you entered.

Begin here: raise only switch 8 and press EXAMINE to select address 0100. Use the reference card to enter the eight bytes. The walkthrough below takes you from the first deposit to the result.

Program reference card All addresses and bytes here are hexadecimal
Enter these eight bytes, starting at 0100. RAM shows what is stored now.
AddressReferenceRAMCheck

0100–0102: 3A 03 00 loads address 3 into A.
0103–0104: C6 01 adds one.
0105–0107: 32 04 00 stores A at address 4.

The byte at 0104 is the amount to add. The reference uses 01; any byte is allowed. Zero bytes already match the initially empty RAM.

Operate the memory panel

ALTAIR 8800

Memory controls · learning view

Address lights The selected location

0 decimal · 0000 hex

Data lights The byte at that location

0 decimal · 00 hex

A lit lamp is 1; a dark lamp is 0. The digits help you read the lights.

Data / address switches Up = 1 · Down = 0

15–8 · Address only

7–0 · Address or data

All switches as an address
0 decimal · 0000 hex
Lower eight as a byte
0 decimal · 00 hex

Setting the switches prepares a number. It does not read or write memory.

Raise only switch 8 and press EXAMINE to select 0100.

Select the address in the switches and read its byte.

Move to the next address and read its byte.

Write the lower eight switches to the selected address.

Move to the next address, then write the lower eight switches.

EXAMINE would select address 0. DEPOSIT would write 0 to the selected address, 0.

Last memory operation

Enable JavaScript to operate the panel.

The 8080 behind the panel

A decimal
0
PC hex
0000
RAM[3] decimal
41
RAM[4] decimal
0

Enter the program, then EXAMINE 0100 to begin.

Last CPU instruction

No instruction has run.

Look inside the last instruction
Step an instruction to see its fetched bytes, memory accesses, and any port transfers.

EXAMINE changes PC without running a program instruction. Stepping advances PC, and the panel lights follow it. This added control executes a whole instruction; the original SINGLE STEP switch advanced one machine cycle.

This lesson connects the panel to an 8080 and 65,536 bytes of RAM. The lights show PC and RAM at PC between instructions; bus cycles and status lamps are not modeled. Start again clears the program, restores 41 at address 3, and starts A and PC at zero. It is not the hardware RESET switch.

You already know this program.

Read the byte at address 3 into A, add one, then store A at address 4. We used these three instructions in Doing something with a byte. Together they occupy eight bytes.

This lesson starts with 41 at address 3 and zero everywhere else. The program area is empty: neither the reference card nor the step button loads it for you. Switches and DEPOSIT write the same RAM that the processor will read.

The reference card uses hexadecimal for addresses and bytes. 0100 is address 256 in decimal, selected by raising switch 8. Values in A and the two data locations are displayed in decimal.

Eight small deposits.

  1. Raise only switch 8 and press EXAMINE. The address lights show 0100.
  2. Prepare 3A, binary 00111010, in the lower eight switches: raise 5, 4, 3, and 1, and lower the others in that group. Press DEPOSIT.
  3. Prepare 03 by raising only 1 and 0 in the lower group. Press DEPOSIT NEXT. It moves to 0101 before writing.
  4. Continue with 00 C6 01 32 04 00, using DEPOSIT NEXT once for each byte. The reference card shows each destination and the byte stored there.

The higher switches can stay where they are during deposits: only the lower eight supply the byte. When preparing a new byte, change the switches that differ and leave the others alone.

Read them back.

Raise only switch 8 again and press EXAMINE. Read 3A at 0100, then use EXAMINE NEXT seven times. The data lights should show 03 00 C6 01 32 04 00 in order.

If a byte differs, leave that address selected, prepare the correct byte, and DEPOSIT. You can repair one location without starting over.

The added reference card helps you check your work. A zero that was already in RAM counts as a match; it does not prove you deposited anything. At 0104, any byte is valid because it supplies the amount to add. Choose 01 for this first run.

Now let the processor read.

Raise only switch 8 and EXAMINE 0100 once more. In this lesson the selected address is connected to the processor’s PC. You have chosen where execution will begin.

Under the panel, press Step one instruction three times, pausing to predict each change:

  1. The 8080 fetches 3A 03 00, then reads address 3. A becomes 41 and PC advances to 0103.
  2. It fetches C6 01 and adds one. A becomes 42, memory stays unchanged, and PC advances to 0105.
  3. It fetches 32 04 00 and writes A to address 4. That location now holds 42, and PC reaches 0108.

Those are the bytes you entered. Open “Look inside the last instruction” to see what the CPU fetched and which memory locations it accessed.

The address lights follow PC after each instruction. To see the result on the data lights, EXAMINE address 4. A remains 42: inspecting memory changes PC, but preserves A and the flags.

Change the program you entered.

EXAMINE 0104 by raising only switches 8 and 2. Prepare 02 in the lower eight switches, then DEPOSIT. You have changed the addition’s operand.

EXAMINE 0100 again and step three times. The load still reads 41, but the addition now produces 43, which the store writes to address 4.

Returning to 0100 does not reset the processor or erase RAM. “Start this lesson again” does: it clears the program and restores the initial data. Use EXAMINE when you want to rerun what you entered.

What this view models

The original Altair’s EXAMINE circuitry made the 8080 jump to the switch address; EXAMINE NEXT advanced it. Here we apply those PC changes directly, preserving other CPU state. Program instructions execute on our 8080 model. The lights show PC and RAM at PC between instructions, rather than every bus transfer. The added step control runs a whole instruction; the hardware SINGLE STEP control advanced one machine cycle. RUN, STOP, timing, and status lamps remain outside this lesson.

For this exercise, the step control requires the reference bytes except the editable operand, and PC at one of the three instruction starts. This teaching guard catches entry mistakes before execution. The original Altair allowed arbitrary programs.

The panel–CPU connection follows the MITS Altair 8800 Theory of Operation, pp. 5–6.