Est. 1976 Beginner

Apple 1 BASIC

Steve Wozniak's hand-assembled, integer-only BASIC for the Apple-1: a 4K interpreter shipped free on cassette in 1976, the first piece of software Apple sold and the direct ancestor of the Apple II's Integer BASIC.

Created by Steve Wozniak

Paradigm Procedural (line-numbered, unstructured BASIC)
Typing Dynamic, weak; 16-bit signed integers (-32767 to 32767) and fixed-maximum-length strings, distinguished by a $ suffix
First Appeared 1976
Latest Version The single 4,096-byte cassette release loaded at $E000-$EFFF (documented in the Preliminary Apple BASIC Users Manual, October 1976); development continued as Integer BASIC for the Apple II in 1977

Apple 1 BASIC (called simply “Apple BASIC” in 1976) is the BASIC interpreter Steve Wozniak wrote for the Apple-1, Apple Computer Company’s first product. It took up exactly 4,096 bytes and was loaded from a cassette tape into memory block $E000–$EFFF. It supported only integers, stored strings as fixed-size character arrays in the Hewlett-Packard style, and was given away free with Apple’s cassette interface card. Wozniak later extended it into the Apple II’s Integer BASIC, and Michael Steil describes the tape as the first software Apple ever sold. In a sense, it marks the start of Apple’s software history.

History & Origins

A computer needs BASIC

Wozniak began going to the Homebrew Computer Club in March 1975, while working at Hewlett-Packard on calculator design. The Altair 8800 and Microsoft’s Altair BASIC were the talk of the hobby scene, and Wozniak drew a firm conclusion. In his 2014 account he wrote: “I sniffed the wind and knew that the key to making my computer good (popular) was to include a high-level language and that it had to be BASIC.”

He also said this was why his designs started at 4 KB of RAM. In his view, 4K was “the minimum needed to run a higher level language”. When 4K dynamic RAM chips became affordable in 1975, he could build a computer that ran BASIC instead of another “switches and lights” machine.

Learning the language from the wrong manual

Wozniak had only used BASIC for a few days in high school, so he picked up an HP BASIC manual late one night at work and made notes on its commands. He did not realize that HP’s BASIC was, in his words, “extremely different than DEC BASIC”, the dialect used by 101 BASIC Computer Games and by Microsoft, especially in how it handled strings. As a result, Apple BASIC took its string model from HP rather than DEC. Every Microsoft-derived BASIC used LEFT$, MID$ and RIGHT$, but Wozniak’s used array-style substrings instead.

Hand-assembled, integer only

Wozniak had no formal training in writing compilers. He drew syntax diagrams for the language and designed his own way to evaluate expressions: a “NOUN” stack for operands, a “VERB” stack for operators, and two priority tables per operator. He has said the approach drew on what he knew about converting expressions into the Reverse Polish Notation used by HP calculators.

He took floating point out of the design on purpose. He hoped to write the first BASIC for the MOS 6502 and to get “a little fame in the hobby world, like Bill Gates”. Dropping decimal numbers saved “a few weeks”. He could not afford time-sharing, so he wrote and assembled the code by hand, and he kept about fifty folders of notes, each labelled GAME BASIC. He showed the interpreter at Homebrew meetings as it grew, adding a few more working commands each month. He says this was “even before Steve Jobs saw that my computer existed.”

Shipping with the Apple-1

Apple Computer was founded on 1 April 1976, and the Apple-1 went on sale that July for $666.66. It was a single assembled circuit board with a 6502, a built-in video terminal and 4K of RAM. Apple’s advertising offered three products:

ProductPrice
Apple-1 (includes 4K bytes RAM)$666.66
Apple Cassette Interface (BASIC tape included)$75.00
Apple 4K byte RAM expansion memory$120.00

The ad promised that “a tape of APPLE BASIC is included free with the Cassette Interface,” and that it “features immediate error messages and fast execution.” It also stated a policy aimed at hobbyists who had been paying for software: “our philosophy is to provide software for our machines free or at minimal cost.”

By October 1976 Apple had published a 14-page Preliminary Apple BASIC Users Manual. It openly warned that it would “most likley, contain errors, incorrect wordings, etc.” (the typo is in the original).

Running Apple BASIC on an Apple-1

Loading the language took some hardware setup:

  1. Memory had to be rewired. The cassette interface manual tells owners to break a solder jumper and move the Apple-1’s second 4K bank of on-board RAM from the 1 block to the E block, “which is where Apple Basic resides.” BASIC itself filled that 4K, and user programs lived in the first bank.
  2. The tape was read from the monitor. With the tape rewound, the user typed C100R to enter the cassette program in the interface card’s PROMs, then E000.EFFFR, started the tape and pressed RETURN. The manual says loading takes “about 30 seconds.”
  3. BASIC was started at a raw address. Typing E000R started BASIC with an empty workspace and showed the > prompt. Typing E2B3R re-entered BASIC with the current program intact, which the manual notes is “extremely useful when you have unintentionally hit the ‘RESET’ button.”

Saving a program worked the same way. The user left BASIC and wrote two memory ranges to tape: BASIC’s pointer area and the program space. After reading them back, the user re-entered BASIC at E2B3. By default, LOMEM started at 2048 and HIMEM at 4096, so a program lived in the 2K between those two addresses unless the user moved the limits.

Language Design

Numbers

The manual’s first rule is simple: “Apple BASIC can represent integers in the range -32767 to +32767.” Any value outside that range caused *** >32767 ERR. Division truncates to an integer, and MOD gives the remainder. Relational and logical operators return 1 or 0. As in HP BASIC, # can be used for “not equal” alongside <>.

Because it stored numbers as 16-bit integers and had no floating-point code, the interpreter fit in 4K. That also made the language well suited to the games and logic programs Wozniak had in mind, and poorly suited to anything that needed fractions.

Variables and arrays

Variable names were short. The manual allows a letter, or a letter followed by a digit (A, T6), for numbers and arrays, and a letter followed by $ for strings. (The Apple II’s Integer BASIC later allowed long variable names.) Apple 1 BASIC had one notable quirk:

In Apple BASIC the first element of an array, A(1) is identical to the simple variable A.

Arrays had one dimension, started at index 1 (a subscript of 0 caused RANGE ERR), and were not initialized.

HP-style strings

Strings were DIMed with a maximum length from 1 to 255 characters; an undimensioned string had a maximum length of zero. Substrings used subscripts instead of functions:

1
2
3
4
5
10 DIM A$(7)
20 A$ = "ABCDEFG"
30 PRINT A$(5)
40 PRINT A$(2,6)
50 END

Line 30 prints EFG (from position 5 to the end), and line 40 prints BCDEF. To join strings, you assign into a position past the end of the target string. The manual gives B$(LEN(B$)+1) = A$ as the way to append. String comparisons in IF allowed only = and #.

Statements and commands

The complete vocabulary fits in a few lines:

KindKeywords
Editing and control commandsAUTO, CLR, DEL, LIST, RUN, SCR, HIMEM=, LOMEM=
StatementsLET, INPUT, PRINT, TAB, FOR/TO/STEP, NEXT, IF/THEN, GOTO, GOSUB, RETURN, DIM, REM, END, POKE, CALL
FunctionsABS, SGN, PEEK, RND, LEN

Several details set it apart from other BASICs:

  • SCR (“scratch”) cleared the program. Most dialects called this NEW, and the Apple II later used that name too.
  • TAB was a statement, not a function inside PRINT: TAB 20: PRINT "Hello".
  • GOTO and GOSUB accepted expressions, so GOTO (A+B/2) was legal.
  • CALL jumped to a 6502 machine-language subroutine, and an RTS returned to BASIC. Together with PEEK and POKE, this was how programs reached the hardware.
  • There were no READ/DATA statements, no graphics and no sound. The Apple-1 had a text-only terminal with 40 columns and 24 lines.
  • Nesting was limited: more than 8 nested FOR loops or GOSUBs caused an error.
  • Pressing any key interrupted a running program at the end of the current line, printing STOPPED AT X. The program could then be resumed with GOTO X.
  • Multiple statements on one line were separated by colons.

A short program in the style of the 1976 manual:

1
2
3
4
5
6
7
10 DIM N$(20)
20 PRINT "WHAT IS YOUR NAME";
30 INPUT N$
40 FOR I = 1 TO 3
50 TAB I: PRINT "HELLO, "; N$
60 NEXT I
70 END

Evolution into Integer BASIC

Apple 1 BASIC had only one public release. Instead of revising it, Wozniak moved the code to the Apple II. That machine was introduced in April 1977 and began shipping in June with the interpreter in ROM, now named Integer BASIC. In his own account, Wozniak recalls designing the new features around games. To write Breakout in BASIC, he added commands to plot in color, draw horizontal and vertical lines, and read paddle controllers, and he thinks this is when he added a speaker for sound effects. The Apple II version also added COLOR=, GR, TEXT, PLOT, HLIN, VLIN, SCRN, PDL, TRACE/NOTRACE, DSP, CON, POP and ASC, renamed SCR to NEW, and dropped the two-character limit on variable names.

Wozniak also wrote floating-point routines for the 6502, but they never made it into his BASIC. As he put it, “When you code by hand … it’s hard to make changes in the middle structure of things that have to be at fixed addresses.” Apple licensed Microsoft’s 6502 BASIC instead. As Applesoft BASIC, it replaced Integer BASIC in ROM when the Apple II Plus arrived in 1979.

The Apple-1 was cut to $475 in April 1977 and dropped from Apple’s price list in October 1977. Apple reportedly offered trade-ins toward Apple IIs, and about 200 boards had been built in total, according to Wozniak. Original machines and BASIC tapes are rare as a result.

Rediscovery

For decades, the interpreter survived only on the few surviving cassettes. In 2002, Achim Breidenbach of Boinx Software received an MP3 recording of an original tape owned by Apple-1 owner Larry Nelson. He decoded it with a program he wrote in GFA BASIC on an Atari ST and published an emulator with a commented disassembly. Other people later “corrected” instructions in that dump that they thought were errors, so the copies in circulation were no longer faithful to the tape.

In July 2008, Michael Steil went back to the audio. He wrote a small C program that measured the width of the pulses in the recording, where the cassette interface reportedly encodes a one bit as a longer (about 1 kHz) cycle and a zero bit as a shorter (about 2 kHz) cycle. He published what he called the “first confirmed perfect dump” of the 4,096 bytes. Four days later he released apple1basic. It is not an emulator but a static recompilation of the original 6502 binary into native Mac OS X Intel code, connected to Unix stdin and stdout. With it, a 1976 program can run as a #!/usr/bin/apple1basic script. Steil also converted several Apple-1-era game programs from tokenized hex dumps back into readable BASIC.

Current Relevance

Apple 1 BASIC is a historical language. Nobody develops it and no official container image exists. The original binary still survives, though, and people run it today in Apple-1 emulators, on hardware replicas, and in recompiled form such as Steil’s apple1basic. Its manual, advertisement and cassette-interface documentation are preserved online, including scans at the Internet Archive.

Why It Matters

  • It was Apple’s first software product. It came bundled free with a hardware card at a time when many hobbyists paid for their BASIC, and Apple’s ads made a point of that.
  • It shaped the Apple II. Integer BASIC, the language in the Apple II’s ROM when it launched in 1977, grew directly out of this 4K interpreter.
  • It shows the HP branch of the BASIC family. Its array-style substrings, # for “not equal” and fixed-length strings came from HP Time-Shared BASIC by way of a manual Wozniak happened to pick up. Microsoft-derived BASICs soon became the norm, and Wozniak reportedly later called the move to “the awful string functions like LEFT$” and MID$ his biggest disappointment.
  • It shows how much fit in 4K. A line editor, tokenizer, expression evaluator, strings, arrays, 16 error messages and a machine-code interface all fit in 4,096 hand-assembled bytes.

Timeline

1975
Wozniak starts going to the Homebrew Computer Club in March 1975 and decides his computer needs BASIC. Working from an HP BASIC manual, he begins writing a 6502 interpreter by hand (work that continued into 1976), keeps his design notes in folders labelled 'GAME BASIC', and shows new commands at club meetings as he finishes them
1976
Apple Computer is founded on 1 April 1976 by Steve Wozniak, Steve Jobs and Ronald Wayne. The Apple-1 goes on sale in July at $666.66, with 4K of RAM included
1976
Apple advertises the $75 Apple Cassette Interface with 'a tape of APPLE BASIC … included free', saying the company's 'philosophy is to provide software for our machines free or at minimal cost'
1976
Apple publishes the 'Preliminary Apple BASIC Users Manual' (dated October 1976). It covers loading the interpreter from tape into $E000-$EFFF, integers from -32767 to 32767, HP-style substrings such as A$(2,6), and 16 error messages
1977
The Apple II is introduced in April and starts shipping in June. Its ROM holds an expanded version of Wozniak's BASIC, now called Integer BASIC, which adds color graphics, paddle input, TRACE and other commands
1977
The Apple-1 price drops to $475 in April. It is dropped from Apple's price list in October 1977 (Wikipedia gives 30 September 1977 as the discontinuation date), and Apple reportedly encourages owners to trade their boards in for Apple IIs
2002
Achim Breidenbach of Boinx Software decodes an MP3 recording of an original Apple-1 BASIC tape owned by Larry Nelson. He publishes an emulator and a commented disassembly, but later copies of the dump contain edits made by other people
2008
Michael Steil re-decodes the cassette audio and publishes what he calls the 'first confirmed perfect dump' of the 4,096-byte binary (14 July 2008). Four days later he releases apple1basic, a static recompilation that runs Apple-1 BASIC natively as a Mac OS X Intel scripting language
2014
Wozniak publishes a first-person account of how he designed the interpreter: its syntax diagrams, his NOUN and VERB stacks for evaluating expressions, and why he dropped floating point to save a few weeks

Notable Uses & Legacy

Apple Cassette Interface bundle

The BASIC tape came free with Apple's $75 cassette card. Michael Steil calls it the first piece of software Apple ever sold (not counting firmware). Without the card, the only way to load a program was to type machine code in hex through the monitor

Apple-1 game tapes

Apple's 1976 advertising promised games at minimal cost. Games written for the Apple-1 in the 1970s, including Blackjack, Acey-Deucey, Bowling, Slot Machine and Star Trek, survive as tokenized BASIC programs, and Steil converted them back into readable source

Apple II Integer BASIC

Wozniak extended the same interpreter into the Apple II's ROM BASIC. It added graphics, sound, paddle input and debugging commands, and was the language early Apple II owners used until Applesoft BASIC replaced it in ROM on the Apple II Plus in 1979

apple1basic for Mac OS X

Michael Steil's 2008 static recompilation turned the original 6502 binary into a native Unix command. It reads programs from files or stdin and can be started with a #! line, so 1976 BASIC programs run like shell scripts

Language Influence

Influenced By

HP Time-Shared BASIC

Influenced

Integer BASIC

Running Today

Run examples using the official Docker image:

docker pull
Last updated: