If the terminal below already shows your earlier BASIC session, press the
browser's RUN button to continue it. You do not need to load the tape again.
This tab keeps the machine, program, terminal, and pending input as you move
between BASIC lessons, visit All lessons, or refresh. Returning always pauses
execution first. Other tabs work independently; a newly opened or duplicated
tab may begin with a copy of this tab's saved session.
Begin a lesson's commands at OK. If your previous program is still asking
a question at ?, finish that conversation first; the ticket loop finishes
when you answer 0. The lesson's setup explains which stored lines to keep
or replace. Typing NEW at OK clears the stored program and variables without
reloading BASIC.
If this is a fresh machine, follow the loading steps below.
This is the original 4K BASIC 3.2 interpreter running on our Altair. An
interpreter is a program that reads your commands and carries them out.
Before it can understand PRINT, the Altair must load that interpreter into memory.
Get the selected paper-tape file from the
machine guide (opens in a new tab).
Return here and choose it in Paper tape below. The file stays on your computer.
Raise only switches A11 and A10. Leave PC at 0000: do not press EXAMINE.
You may then close the front panel to bring the terminal closer.
Press the browser's RUN button. Click Terminal keyboard and answer
each question when it appears:
When you see
Enter
MEMORY SIZE?
Just Enter, to let BASIC find the available memory.
TERMINAL WIDTH?
Just Enter, to keep the default.
WANT SIN?
Y then Enter. We will not need this math function today.
When 727 BYTES FREE and OK appear, BASIC is ready. Leave the processor
running for the lesson. Switching tabs pauses it; press the browser's RUN
button when you return.
If you need to start loading again, use Start fresh, raise A11 and A10 again,
then RUN. This discards the current BASIC program and uses the tape you already
selected. Reset CPU + serial does not reload BASIC.
The saved session stays in this browser tab's temporary storage. It is not
sent to the site. Copy your numbered lines somewhere to keep them beyond the
browser session. If the browser cannot save or restore a session, a message
beside the machine explains that; you can still use the current page.
This tab can keep your BASIC session between lessons. Checking for a saved session…
The file stays on your computer. Selecting a verified tape prepares a fresh, stopped machine.
No tape selected.
Front panel · address, data, and sense switches
To load BASIC, raise only A11 and A10 and leave PC at 0000.
Do not press EXAMINE after raising the loading switches. You can then close this panel to bring the terminal closer.
EXAMINE and NEXT change PC. Only 0000–0FFF contain RAM; other addresses read FF and discard deposits.
Lights show instruction boundaries, not individual bus cycles.
Stopped · 0 instructions
RUN lets the processor execute; STOP pauses it. At BASIC’s prompt, type RUN
to run your BASIC program. Break sends Control-C to BASIC.
0 keyboard bytes queued
Use uppercase commands. Enter sends a line; Backspace sends BASIC’s erase character (_).
Paste one line at a time. Only the machine’s echoes appear above.
Inspect the running machine
Latest twelve instructions on this page · PC before → after (hexadecimal)
Reset keeps RAM and the switches but resets the CPU and serial device. Start fresh discards the program, restores the bootstrap,
rewinds the selected tape, and clears the terminal; raise the switches again before RUN.
Add one to what is there
Load or resume BASIC using the instructions above, and begin at OK. If the
previous lesson's ticket program is still
asking a question, answer 0 to finish it. We will make a different program,
so type NEW to clear the stored lines and variables.
First, try these commands without line numbers:
Type, then Enter
NEW
BASIC replies
OK
Type, then Enter
LET N=1
BASIC replies
OK
Type, then Enter
PRINT N
BASIC replies
1
OK
Type, then Enter
LET N=N+1
BASIC replies
OK
Type, then Enter
PRINT N
BASIC replies
2
OK
LET N=N+1 is an instruction to change N. BASIC first works out the
expression on the right using the old value of N: 1 + 1 is 2. It then
stores that result as the new value of N. The old 1 has been replaced.
Here = means assignment. We are not claiming that a number is equal to
itself plus one. In IF N=1 THEN ..., the same symbol would test equality
without changing N.
What will the same command do a second time?
Type, then Enter
LET N=N+1
BASIC replies
OK
Type, then Enter
PRINT N
BASIC replies
3
OK
The text of the instruction did not change, but the value it read did.
This time it calculated 2 + 1. We could also write N=N+1 without LET;
we will keep LET here to make the assignment easy to spot.
Now let the stored program do the counting. Enter one numbered line at a
time, pressing Enter and waiting for its complete echo before the next:
Type one line at a time, then Enter
10 LET N=1
20 PRINT N
30 LET N=N+1
40 IF N<=5 THEN 20
50 END
Line 10 chooses the starting value. Line 20 prints it, and line 30 adds one.
Line 40 decides whether we should return to PRINT with that new value.
The two characters <= mean less than or equal to. N<=5 is true for
1, 2, 3, 4, and 5, and false for 6. Type both characters, with < first.
Unlike the assignment on line 30, this comparison does not change N.
Check the program with LIST:
Type, then Enter
LIST
BASIC replies
10 LET N=1
20 PRINT N
30 LET N=N+1
40 IF N<=5 THEN 20
50 END
OK
Then RUN it:
Type, then Enter
RUN
BASIC replies
1
2
3
4
5
OK
There is no INPUT in this program. It produces all five numbers without
waiting for an answer from you.
Each trip through lines 20, 30, and 40 uses the value left by the previous
trip. The branch returns to line 20, so it passes over the assignment of 1
on line 10.
N printed on line 20
N after line 30 adds one
Is N <= 5?
Next line
1
2
Yes
20
2
3
Yes
20
3
4
Yes
20
4
5
Yes
20
5
6
No
50
What does N hold when we return to OK? The last printed number and the
last stored value are different. Ask BASIC:
Type, then Enter
PRINT N
BASIC replies
6
OK
The program printed 5, then changed N to 6. The comparison prevented another
trip to PRINT. END finished the run without erasing N.
Type RUN again:
Type, then Enter
RUN
BASIC replies
1
2
3
4
5
OK
A new RUN starts at line 10, which gives N the value 1 again. Within each
run, the loop returns to line 20 and lets N keep growing.
Choose an earlier stopping point
Change only line 40. Predict which numbers will appear, and what N will
hold afterward.
Type one line at a time, then Enter
40 IF N<=3 THEN 20
RUN
BASIC replies
1
2
3
OK
Type, then Enter
PRINT N
BASIC replies
4
OK
The same start, print, and add instructions now stop after printing 3.
The value 4 fails the comparison, just as 6 did before.
Restore the limit of 5 for the next lesson:
Type one line at a time, then Enter
40 IF N<=5 THEN 20
RUN
BASIC replies
1
2
3
4
5
OK
Our loop has four jobs: choose a starting value, do something with it,
change it, and test whether to repeat. In
the next lesson, FOR and NEXT will express
this counting pattern directly.
You can keep experimenting in the terminal. This tab carries the BASIC machine and program between these lessons,
including a visit to All lessons, and restores them paused after a refresh. Press the browser's RUN button to continue.
Start fresh discards the program and reloads the retained tape. Copy your numbered lines somewhere for a lasting copy;
browser session storage is temporary.
The machine guide (opens in a new tab)
explains the hardware, loading process, and recovery controls. These lessons use that same machine and original interpreter.