Meet the Altair · Putting the pieces together

A tiny
command prompt.

The computer can print a question, remember your answer, and decide what to do. Then it can come back for another answer. You already know most of the pieces.

Begin here: Choose 20 instructions per second and press RUN. When > appears, send the prepared H. After the device becomes empty, press Send line feed. Watch H appear, followed by HELLO and another prompt. STOP pauses the program; it does not finish by itself.

Loaded command prompt · reference card All addresses and bytes here are hexadecimal
These 116 program bytes are loaded at 0000. The buffer begins at 0100; messages at 0120, 0130, 0140, and 0160. RAM shows what is stored now.
AddressReferenceRAMCheck

0000 sets SP to 0200. At 0003, the caller selects the prompt at 0120 and calls the printing routine at 0065. Then it sets HL to buffer address 0100 and B to eight slots.

000E calls the receive routine at 005B. LF selects the line ending at 0026. Other bytes are stored through HL, echoed with OUT, and counted with DCR B. When B reaches zero, 001E receives and discards further bytes until LF.

0026 appends NUL and outputs LF. MOV A,B copies the remaining count for comparison: eight slots means an empty line; seven means exactly one character. Longer lines select UNKNOWN. The one-character path reads RAM at 0100 and compares with 48 (H) and 3F (?).

0046 selects UNKNOWN at 0160; 004C selects HELLO at 0130; 0052 selects the help text at 0140. All call the same printing routine, then jump to 0003 for another prompt.

005B polls input port 0 until ready, receives from port 1 into A, and returns. 0065 saves HL with PUSH H, prints nonzero bytes through the pointer, restores it with POP H, and returns. Neither routine changes B.

Only the program bytes are guarded. Buffer, message, and stack data remain editable while stopped. Input is matched by the 8080 program; the viewer neither recognizes commands nor chooses responses.

Operate the memory panel

The 8080 behind the panel

A decimal
0
PC hex
0000
HL address · hex
0000
SP stack address · hex
0000
B slots left · decimal
0

Character input Port 0: readiness · Port 1: data

Prepared: H. Enable JavaScript to see its byte value and send it.

Typing prepares a character. Send or Enter offers it to the device. Line feed sends byte 10 separately.

Device empty. No byte waiting.

Ready now: 0 · empty

One byte can wait. When full, prepare another character here; it stays unsent until you send it after the CPU receives the first.

Received text Output port 1


    Waiting for output
  

No byte sent yet.

0 writes received.

Only OUT adds text. LF starts a new line; other non-printing bytes appear as labels in angle brackets.

Zero flag Z: 0 · the latest comparison or count decrement’s answer

CPU halted: no

The program is loaded. Enable JavaScript to run or step it.

Last CPU instruction

No instruction has run.

Follow the buffer and stack

Command buffer in RAM

Addresses and bytes in hexadecimal; characters interpreted as ASCII.
AddressByteCharacter
0100 00NUL
0101 00NUL
0102 00NUL
0103 00NUL
0104 00NUL
0105 00NUL
0106 00NUL
0107 00NUL
0108 00NUL

Enable JavaScript to follow HL.

The marker follows HL. Looking at these bytes changes no CPU or memory state.

Saved values in RAM

Addresses and bytes in hexadecimal.
AddressByteRole
01FC 00Saved L
01FD 00Saved H
01FE 00Return · low
01FF 00Return · high

Enable JavaScript to follow SP.

The marker follows SP. Looking at these bytes changes no CPU or memory state.

B counts unused slots. The first eight characters are stored and echoed; further characters are received but discarded until LF. LF appends NUL and starts command selection. Returning to the prompt resets HL and B, leaving old RAM bytes until they are overwritten.

The print routine uses all four locations. The receive routine uses only the return-address pair. Labels describe those uses; the released bytes remain in RAM. Between calls SP is 0200.

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

0 instructions executed.

    RUN and STOP are teaching controls at instruction boundaries. Pace is for reading, not a simulation of the Altair’s clock. This page stops running when hidden. Looking at these readouts changes no state; EXAMINE changes PC.

    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.

    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.

    Lower all switches and press EXAMINE to select 0000.

    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.

    This lesson connects an 8080, 65,536 bytes of RAM, and teaching byte-input/output devices. It keeps processing lines until you STOP. Start again restores the program and messages, clears the buffer, stack, CPU state, devices, output, counts, and history, prepares H, and stops at PC 0000. It is not the hardware RESET switch or a historical command interpreter.

    One line at a time.

    The prompt, > , is an invitation to enter a command. It is two bytes in RAM, printed by the same kind of routine we used in the previous lesson. The CPU sends them to output port 1.

    This program knows two commands. Send uppercase H for a greeting, or ? for help. Finish each command with the separate Send line feed button. The program waits for that ending before deciding what your line means.

    The input field still prepares just one character. Enter sends that character; it does not end the line. Wait for the input device to be empty before sending another byte. There is no line editor or backspace here.

    > H
    HELLO
    > ?
    H=HELLO ?=HELP
    > 

    Every visible character in this conversation comes from an OUT instruction, including the echo of your input. Preparing or sending H does not immediately put it in RAM or on the display.

    A main loop and two routines.

    The main program repeats four jobs: print a prompt, read a line, choose a reply, and print it. A jump brings execution back to the prompt. There is no HLT instruction.

    One routine receives a byte. It keeps checking readiness at input port 0, then reads input port 1 and returns with the byte in A. The other routine prints a message beginning at HL, stopping at NUL. PUSH H and POP H preserve the caller's pointer.

    Both routines use CALL and RET. Open Follow the buffer and stack to see the return address. Printing also saves H and L below it. Each completed call brings SP back to 0200, so processing more commands does not keep using more stack space.

    A command is data until the program interprets it.

    Open Follow the buffer and stack to watch the input loop write characters at 0100 onward. HL points to the next free location, and B counts the unused slots. Line feed is not stored: it makes the program append NUL and print a new line.

    MOV A,B copies the remaining count into A so CPI can test it. B itself is unchanged. Eight slots left means an empty line; seven means exactly one character. Any longer line selects UNKNOWN.

    For a one-character line, the CPU reads the byte back from RAM at 0100. It compares with 72 decimal for H, then 63 for ?. Conditional jumps choose which message address to put in HL. The common printing routine reads that message from RAM.

    An empty line brings back the prompt without a reply. Lowercase h, a space, HI, and every other unrecognized line produce UNKNOWN. Matching is exact: a line beginning with H is not enough.

    A full buffer still needs an ending.

    The buffer has eight character slots and an extra location for NUL. After the eighth store, B reaches zero and HL is 0108. The program stops storing and echoing characters, but it keeps receiving and discarding them until line feed arrives.

    Only then does it append NUL, respond UNKNOWN, and print another prompt. It waits for the whole line's ending so that unwanted extra characters cannot become the next command.

    Starting the next line resets HL and B. It does not erase the old bytes: the next line overwrites them and writes its own terminator. Seeing old text in RAM does not mean that text is a pending command.

    The reply lives in memory too.

    The greeting begins at 0130. The help message begins at 0140, and UNKNOWN at 0160. They are ordinary zero-terminated byte strings. Choosing an address and printing its contents are separate parts of the program.

    Make H say JELLO

    Start again and step 24 times, stopping at PC 005B. On the panel, EXAMINE 0130. Set the switches to 004A and DEPOSIT: that replaces H with J. EXAMINE 005B to restore the paused PC, then RUN and send H followed by LF. The command still selects the greeting, but the printing routine now reads JELLO from RAM. Start again restores HELLO.

    STOP preserves the current instruction boundary, input, RAM, and output. RUN continues from there. Start this lesson again creates a fresh experiment, including empty devices and a restored program.

    From bytes to a conversation.

    You began with individual bits. This program combines numbers, memory, registers, instructions, loops, decisions, input, output, and subroutines into something you can use. The prompt is an ordinary program running on the same CPU you have been following.

    Next, use the original Altair BASIC interpreter to calculate and store a small program. It runs on the same 8080, with a historical serial interface. Use All lessons below to revisit any of the pieces.

    What this models

    The program runs on the 8080 model with RAM and the teaching byte devices from earlier lessons. Browser controls prepare and offer input; the 8080 executes all command handling. The display retains the latest 256 output bytes. This is a teaching program, not an Altair monitor, BASIC, operating system, or model of a historical terminal. The panel remains available for memory experiments; jumping into the middle of routines can bypass their setup.