Est. 1977 Beginner

Applesoft BASIC

Microsoft's floating-point 6502 BASIC as adapted by Apple: the tokenised, line-numbered interpreter at the ] prompt of every Apple II from the II Plus onward, with hi-res graphics, two-character variable names and a hook for machine code.

Created by Microsoft (6502 BASIC, usually credited to Marc McDonald and Ric Weiland), adapted for the Apple II at Apple by Randy Wigginton and colleagues

Paradigm Procedural (line-numbered, unstructured BASIC)
Typing Dynamic, weak; 5-byte (40-bit) floating-point reals, % integers (-32767 to 32767 per Apple manuals) and $ strings (0-255 characters)
First Appeared 1977
Latest Version Applesoft II (1978); carried essentially unchanged in Apple II ROMs, with small fixes in the Enhanced IIe ROMs of March 1985, until the line ended in 1993

Applesoft BASIC is the dialect of Microsoft BASIC that Apple licensed for the Apple II and, from the Apple II Plus of 1979 onward, built into the ROM of every machine in the line. Switch on an Apple II Plus, IIe, IIc or IIGS with no disk to boot (on disk-equipped machines, typically after pressing Reset to stop the drive searching) and you land at a ] prompt: that bracket is Applesoft waiting for input. For a generation of home and school programmers it was simply what “programming the computer” meant.

As a language it is a typical late-1970s Microsoft BASIC: line-numbered, unstructured, dynamically typed, with floating-point arithmetic, whole-value strings and multi-dimensional arrays. Apple added graphics commands for the Apple II’s low- and high-resolution screens and a small set of hooks into machine code. This entry concentrates on the language as programmers wrote it and on how the interpreter works. Apple IIe BASIC covers the IIe-specific firmware.

History & Origins

Why Apple licensed it

Wozniak wrote the Apple II’s original BASIC himself, by hand, without an assembler. He left out floating-point arithmetic deliberately: as he later put it, he was primarily interested in writing games, and integers were enough for that. Business and scientific users wanted real numbers, and Commodore had licensed Microsoft’s 6502 BASIC for the PET, which shipped with floating-point arithmetic.

Microsoft had a 6502 BASIC by 1976 and no 6502 computer of its own to sell it on. When it approached Apple, Steve Jobs turned it down, saying Apple had its own BASIC. As the complaints mounted, Apple changed its mind. The name Applesoft is a contraction of the two companies’ names.

Accounts of the terms differ in detail. Apple II History records a flat-fee license in two halves, with Apple paying $10,500 for the first half, for a total of $21,000; Wikipedia gives a flat fee of $31,000. Andy Hertzfeld records the term that mattered most later: the license ran for eight years.

Getting it to work

The source listing Apple received was buggy. Apple had no 6502 assembler in-house, so Randy Wigginton assembled the code by sending it down a 110-baud modem line to a timesharing service, Call Computer. When Call Computer lost the source to an equipment failure and its backups proved useless, Cliff Huston rescued the project by cross-assembling the code on his own IMSAI 8080.

Dating the first Applesoft

The 1977 date holds up. A surviving Apple manual, the APPLESOFT Extended Precision Floating Point BASIC Language Reference Manual for the “Cassette – RAM Version”, is dated November 1977 and carries two copyright lines: “Copyright, 1977, Apple Computer Inc.” and “Copyright, 1977, Microsoft Co.” Its introduction describes Applesoft as “a powerful, floating point BASIC written expressly for the Apple II computer by Microsoft” and aims it at “business, science and educationally oriented applications which require extensive manipulation of decimal numbers.” Those were the uses Wozniak’s integer-only BASIC could not serve.

That first release, now called Applesoft I, was built on Microsoft’s 6502 BASIC version 1.1 and loaded from cassette into RAM. It kept Microsoft’s MEMORY SIZE? start-up prompt, replaced Microsoft’s OK prompt with a ], and used oddly abbreviated low-resolution graphics commands such as PLTG, PLTC and PLTP. It had no high-resolution graphics, no ONERR error trapping and no & statement.

The Applesoft I cassette reportedly took several minutes to read in, and the interpreter occupied the memory the high-resolution screen needed.

Applesoft II

Applesoft II, released in 1978, is the version nearly everyone means by “Applesoft”. Its reference manual (©1978) describes two ways to get it: on cassette, “provided … at no charge, with each APPLE II” and occupying about 10K of RAM, or in ROM on a plug-in Firmware Card (Apple part A2B0009X), where “the flick of a switch and two key-strokes” started the machine in Applesoft. The manual still positions the two BASICs side by side. Integer BASIC is “very fast” and suited to “education, game playing, and graphics”, while Applesoft is “better suited for most business and scientific applications.”

When the Apple II Plus appeared in 1979, Applesoft II moved into the motherboard ROM at $D000–$F7FF, and Integer BASIC became a file on the DOS 3.3 disk. From then on Applesoft was the Apple II’s default language, and it stayed so on every later model.

Applesoft II came from version 2 of Microsoft’s 6502 BASIC, in which Microsoft had fixed a number of bugs, and Wigginton and others reworked it in spring 1978. Besides cassette and the Firmware Card, it also reached customers on diskette and the Language Card.

Design Philosophy

Applesoft was not designed from a clean sheet. It is Microsoft’s portable 6502 BASIC with Apple-specific commands grafted on, and its character follows from that:

  • Numbers are floating point by default. Microsoft’s core gave every numeric variable a 5-byte real representation. This was the feature Apple’s customers were asking for, and it is also the main reason the language is slower than Integer BASIC.
  • Memory efficiency over readability. Keywords are stored as single-byte tokens, spaces are discarded on entry, and only the first two characters of a variable name are kept. On a 16K–48K machine, program space mattered more than descriptive names.
  • Compatibility with Integer BASIC habits. Applesoft II adopted Integer BASIC’s names for the low-resolution graphics commands (GR, COLOR=, PLOT, HLIN, VLIN) and its screen commands (HTAB, VTAB, CALL, PR#, IN#), so existing Apple II users did not have to relearn them.
  • An escape hatch to machine code. Apple assumed that serious programs would drop into assembly language for speed. PEEK, POKE, CALL, USR and & are all part of the language, not afterthoughts.

Key Features

Program structure

A program is a sequence of numbered lines. According to the Applesoft II manual, line numbers run from 0 to 63999, and a line may hold up to 239 characters as typed. Several statements can share a line, separated by colons. ? is accepted as shorthand for PRINT and becomes the same token.

1
2
3
4
5
6
7
8
10  REM  SIEVE OF ERATOSTHENES
20  HOME : N = 1000: DIM F%(N)
30  FOR I = 2 TO N
40  IF F%(I) THEN 70
50  PRINT I;" ";
60  IF I * I <= N THEN  FOR J = I * I TO N STEP I:F%(J) = 1: NEXT J
70  NEXT I
80  END

Two Applesoft quirks are visible here. The manual says a FOR loop’s variable is compared with its limit “only at the bottom of the FOR…NEXT loop, [so] the portion of the program inside the loop is always executed at least once.” Without the IF guard on line 60, FOR J = 1024 TO 1000 would still run once and fail with a bad subscript. A false IF also skips everything else on its line, so the whole inner loop on line 60 is skipped when the condition fails. The loop variables are reals because the manual states that an integer variable used as a FOR index gives ?SYNTAX ERROR.

Data types

TypeWrittenStorage (per the Applesoft II manual)Range
RealAB5 bytes (40 bits)about ±9.99999999E+37; prints up to nine digits
IntegerAB%2 bytes in arrays±32767 per Apple’s manuals (Wikipedia gives -32768 to 32767)
StringAB$3-byte descriptor plus 1 byte per character0 to 255 characters

Each simple variable takes 7 bytes: 2 for the name and 5 for the value, even for integers. So the % type saves memory only in arrays, and integer arithmetic is converted back to floating point anyway. Arrays can have many dimensions. The manual is not quite consistent about the limit: its syntax chapter gives 89 dimensions, while its worked example says 88 zero-size dimensions succeed and 89 give ?OUT OF MEMORY ERROR. It also notes that an array used before it is DIMensioned gets a default maximum subscript of 10.

Inside the 5-byte real, an 8-bit exponent, a sign bit and a 31-bit significand give roughly nine significant digits. Strings are garbage-collected and handled as whole values, not as character arrays.

Variable names and reserved words

Only the first two characters of a name are significant, so AB% and AB3QS% are the same integer variable. And because the tokeniser looks for keywords anywhere in the input, a name may not contain a reserved word. The manual’s own examples of illegal names are TO and RGOTO, and the classic trap is SCORE, which hides OR. The manual also admits some oddities: XPLOT is reserved but “does not correspond to a current APPLESOFT command,” and COLOR, HCOLOR, SCALE, SPEED and ROT are treated as keywords only when followed by =.

Graphics

Applesoft II’s graphics vocabulary splits in two:

  • Low resolution (40×48 in 16 colours): GR, COLOR=, PLOT, HLIN, VLIN, SCRN(.
  • High resolution (280×192): HGR, HGR2, HCOLOR=, HPLOT ... TO ..., plus shape tables drawn with DRAW and XDRAW and transformed with ROT= and SCALE=, loaded from cassette with SHLOAD.

Mixed mode leaves four lines of text at the bottom of the screen. The double-high-resolution mode of later 128K machines and the IIGS’s own graphics modes were never supported directly.

Talking to hardware and machine code

MechanismWhat it does
PEEK(addr) / POKE addr, valueRead or write any memory location, including soft switches in the I/O space
CALL addrJump to a machine-language subroutine
USR(x)Pass a value to a machine-language routine and get a numeric result back
&Jump to location $3F5, where a program can place a vector to its own command parser
PR#n / IN#nRedirect output or input to the card in slot n
WAIT addr, maskPause until a memory location’s bits match

The 1978 manual describes & as “intended for the computer’s internal use only; it is not a proper APPLESOFT command.” It became the most important extension point in the language anyway. Ampersand packages parsed whatever followed the & by calling routines inside the Applesoft ROM, which let them add new statements that looked native.

Disk access was not part of Applesoft at all. Under DOS 3.3, and later under ProDOS’s BASIC.SYSTEM, a program issued disk commands by PRINTing a Ctrl-D followed by text such as OPEN, READ or CATALOG. The operating system watched the output stream and intercepted them.

What it lacked

Applesoft gave the Apple II floating-point math, string arrays, DATA/READ, one-line functions with DEF FN, and error trapping with ONERR GOTO and RESUME. It also left several things out:

  • No MOD, which Integer BASIC had had, and no bitwise operators.
  • No INSTR, PRINT USING, INKEY$ or LPRINT, conveniences present in various other BASICs of the era.

Known bugs

Two defects are well documented. The ONERR GOTO mechanism does not restore the stack if a handler fails to exit through RESUME, so error-handling code that simply jumps elsewhere can eventually crash the machine. The RND function’s seeding also makes the sequence it produces more predictable than the documentation implies.

How the Interpreter Works

Applesoft is a tokenising interpreter, and its internals were documented in unusual detail in Apple’s own manual, which is why so many programmers learned to poke at them.

Tokenisation. When a line is entered, each reserved word is replaced by a one-byte token from 128 (END) to 234 (MID$), and spaces outside strings are discarded. LIST reconstructs the text and adds its own spacing, so 10 C=+5/-6: B=-5 lists as 10 C = + 5 / - 6 : B = - 5. Numeric literals are not converted to binary at entry time; they stay as ASCII digits and are parsed again every time the line runs.

Memory map. In the ROM version a program starts at $801. Zero-page pointers mark the boundaries of each region. $67–$68 holds the start of the program, $69–$6A the start of simple variables (LOMEM:), $6B–$6C the start of arrays, $6D–$6E the end of arrays, $6F–$70 the bottom of string storage and $73–$74 HIMEM:. Strings grow downward from HIMEM: toward the arrays. The manual warns that string space “may fill with old data and run over the high-resolution screens,” and recommends X=FRE(0) to force a clean-up.

Execution. The interpreter’s CHRGET routine, copied into zero page, fetches each character of the running program. Lines are stored as a linked list, so a GOTO or GOSUB searches from the start of the program for its target. Variables sit in a table in the order in which they were first encountered, and each reference searches that table.

Stack use. The manual lists the costs: 16 bytes per active FOR loop, 6 bytes per pending GOSUB, and 4 bytes per parenthesis level plus 12 bytes per temporary result during expression evaluation. FOR loops nested more than 10 deep produce ?OUT OF MEMORY ERROR.

Performance

Apple’s Applesoft II manual includes an appendix titled “Speeding Up Your Program” whose first hint is in capitals: “THIS IS PROBABLY THE MOST IMPORTANT SPEED HINT BY A FACTOR OF 10: use variables instead of constants,” because converting a literal to floating point costs more than fetching a variable. The other hints follow directly from the internals:

  1. Refer to the most-used variables first, so they sit near the front of the variable table.
  2. Write NEXT rather than NEXT I, which skips a check.
  3. Put frequently called subroutines near the start of the program, because every GOTO and GOSUB searches from the lowest line.

The most thorough published measurement is “A Comparison of Five Compilers for Apple BASIC” by Joseph H. Taylor and Jeffrey S. Taylor in BYTE, September 1982. They ran eight benchmark programs on a 48K Apple II or II Plus and used the Applesoft interpreter as the baseline. The interpreter’s own timings:

BenchmarkWhat it doesApplesoft interpreter time
PRIME1Primes below 1000 by the Sieve of Eratosthenes16.9 s
PRIME2Primes below 1000, Porter’s algorithm28.2 s
SIGAVSignal-averager program44.2 s
KBAUD7Rugg and Feldman’s Kilobaud benchmark 746.3 s
SORTSort a list of numbers24.8 s
ALPHASort a list of words alphabetically15.4 s
MATINVInvert a 10×10 matrix40.2 s
FFT64-point complex Fourier transform22.6 s

Across these programs the Taylors found that code from the four Applesoft compilers “generally runs 2 to 10 times faster” than the same programs under the interpreter. Microsoft’s TASC was fastest “by a substantial margin” when its integer option could be used, because it and Hayden’s compiler did 16-bit integer arithmetic where the interpreter did not. On floating-point-heavy programs such as MATINV and FFT the compilers performed more alike. All of them called the interpreter’s own ROM routines for floating-point work and functions like SQR, SIN and LOG. The same article measured Galfo Systems’ Integer BASIC compiler at “15 or more times faster than Applesoft” on programs that Integer BASIC could handle, which shows how much the floating-point default cost when it was not needed.

Evolution

Very little changed in the language after 1978. Because a great deal of commercial software called entry points inside the ROM, Apple kept the interpreter essentially fixed:

MachineDateEffect on Applesoft
Apple II Plus1979Applesoft II moves into motherboard ROM, replacing Integer BASIC
Apple IIeJanuary 1983Same interpreter; new firmware adds 80-column and arrow-key editing around it
ProDOS1984Disk commands move from DOS 3.3 to BASIC.SYSTEM; the language itself is unchanged
Apple IIcApril 1984Applesoft kept in ROM; Apple deliberately avoided larger interpreter changes for compatibility
Enhanced IIeMarch 1985Lowercase keyword entry; GET, HTAB, TAB, SPC and comma tabbing fixed for 80 columns
Apple IIGSSeptember 1986Applesoft kept in ROM for compatibility

The IIGS also had Apple’s separate GS BASIC, which John Arkley derived from Apple III Business BASIC rather than from Applesoft.

Improvements came from outside Apple instead: ampersand utilities, program editors, and compilers. The 1982 BYTE review lists four Applesoft compilers, priced from $100 to $175.

TASC’s passes were reportedly written largely in Applesoft, and TASC was used to compile itself.

Compatibility mattered beyond Apple, too. Coleco said the Adam’s SmartBASIC was source-compatible with Applesoft for programs that did not PEEK or POKE into the hardware, and Microsoft licensed an Applesoft-compatible BASIC to VTech for the Laser 128 clone.

The price of the license

The event with the largest consequences in Applesoft’s later history had nothing to do with the code. Hertzfeld’s account is that as the eight-year license approached its September 1985 expiry, Apple still depended on Apple II revenue and could not walk away from the language its software base ran on. Microsoft used that leverage. Apple abandoned MacBASIC, selling it to Microsoft for one dollar, and granted a perpetual license to the Macintosh user interface, in a deal John Sculley signed in November 1985. Hertzfeld calls it “probably the single worst deal in Apple’s history.” Donn Denman, who had written MacBASIC, was told to destroy the source.

Current Relevance

Applesoft is historical. No current hardware runs it natively, and there is no official container image or supported toolchain. It is still easy to run, though:

  • Emulators run the original ROM. AppleWin, an Apple II emulator for Windows, is still maintained; its v1.32.0.0 release is dated May 2026.
  • Reimplementations skip the hardware entirely. Joshua Bell’s Applesoft BASIC in JavaScript, developed on GitHub since 2013, runs Applesoft listings in a web browser.
  • Source code is now public at the Microsoft end. On 3 September 2025 Microsoft published the source of Microsoft BASIC for 6502 version 1.1 under the MIT License. It is the version Applesoft I was built on, and it includes an Apple II build configuration. Michael Steil’s reconstruction project, msbasic, reassembles Applesoft I byte-for-byte from a single source tree shared with Commodore, OSI and KIM BASIC. Its README notes that it cannot yet build Applesoft II.
  • Documentation survives as scans. The November 1977 Applesoft manual, the 1978 Applesoft II reference manual and the TASC manual are all on the Internet Archive.

Retrocomputing hobbyists still write new Applesoft programs, and type-in listings from Nibble, Call-A.P.P.L.E. and Creative Computing are still circulated and run. Besides AppleWin, Virtual ][ and MAME’s Apple II drivers run the original ROM interpreter, and the Apple II ROMs have been disassembled and annotated in public.

Why It Matters

  • It was the default language of a major personal computer for fourteen years. From 1979 to 1993, every new Apple II dropped to Applesoft when there was no disk to boot. Many people’s first program was written at its ] prompt.
  • It is a well-documented example of the Microsoft 6502 BASIC family. Applesoft, Commodore BASIC and their siblings shared one code base. With Microsoft’s 2025 source release and the byte-exact reconstructions, Applesoft has become one of the easiest early interpreters to study at the source level.
  • Its trade-offs are a lesson in design for 8-bit machines. Two-character names, tokenised storage, ASCII literals re-parsed at run time and linear line searches all saved memory at a measurable cost in speed. The compiler market that grew up around Applesoft existed because of those choices.
  • It shows how extension hooks outlive the language’s own development. Apple changed Applesoft very little after 1978, but &, USR, CALL and PEEK/POKE let third parties keep extending it for as long as the Apple II was sold.

Timeline

1976
Microsoft develops its BASIC for the MOS Technology 6502; the source code Microsoft later published carries copyright dates of 1976-1978 and conditional-assembly settings for the Apple II, Commodore PET, Ohio Scientific and KIM-1
1977
With customers complaining that Integer BASIC has no floating-point math, Apple licenses Microsoft's 6502 BASIC. Randy Wigginton begins adapting it for the Apple II; Cliff Huston uses his own IMSAI 8080 to cross-assemble the code after the timesharing service holding it loses the source
1977
Apple publishes the APPLESOFT Extended Precision Floating Point BASIC Language Reference Manual (Cassette - RAM Version), dated November 1977 and copyright both Apple Computer and Microsoft. This first Applesoft, based on Microsoft 6502 BASIC version 1.1, has no hi-res graphics, ONERR or & statement
1978
Applesoft II is released. Its reference manual (copyright 1978) offers it on cassette, which it says is provided at no charge with each Apple II, or in ROM on a plug-in Firmware Card; the cassette version occupies about 10K of RAM
1979
The Apple II Plus puts Applesoft II in ROM at $D000-$F7FF in place of Integer BASIC; without a disk to boot, the machine now drops to Applesoft's ] prompt
1981
Microsoft releases TASC (The Applesoft Compiler), which compiles Applesoft programs to 6502 machine code
1982
BYTE's September issue benchmarks four Applesoft compilers (Hayden's Applesoft Compiler, Microsoft's TASC, On-Line Systems' Expediter II and Southwestern Data Systems' Speed Star) against the Applesoft interpreter, finding that compiled programs generally run 2 to 10 times faster
1983
The Apple IIe arrives in January with Applesoft still in ROM, on a machine that now has lowercase, arrow keys and an optional 80-column display the 1978 interpreter was never written for
1984
ProDOS moves disk handling to a separate program, BASIC.SYSTEM, while Applesoft stays in ROM. The Apple IIc, released in April, also keeps Applesoft in ROM
1985
The Enhanced Apple IIe (March) ships ROMs that let Applesoft keywords be typed in lowercase and fix GET, HTAB, TAB, SPC and comma tabbing in 80-column mode, among the few changes ever made to the interpreter
1985
Apple's eight-year Microsoft license is due to expire in September. According to Andy Hertzfeld, Bill Gates makes renewal conditional on Apple killing MacBASIC and also extracts a perpetual license to the Macintosh user interface; John Sculley executes the deal in November
1986
The Apple IIGS ships in September with Applesoft still in ROM for compatibility with existing Apple II software
1993
Apple drops the Apple IIe from its price lists in November, ending new hardware that runs Applesoft natively
2025
On 3 September Microsoft publishes the source code of Microsoft BASIC for 6502 version 1.1, the version Applesoft I was built on, on GitHub under the MIT License

Notable Uses & Legacy

Akalabeth: World of Doom

Richard Garriott wrote Akalabeth, the precursor to the Ultima series, mostly in Applesoft BASIC in 1979; California Pacific Computer Company published it for the Apple II in 1980

Scientific benchmarking on the Apple II

Princeton physicist Joseph H. Taylor and his son Jeffrey used Applesoft programs for matrix inversion, a 64-point Fourier transform and string sorting as the reference workload in BYTE's September 1982 comparison of Apple II BASIC compilers

Commercial software shipped as compiled BASIC

Compilers such as TASC, Expediter II and Speed Star let developers distribute an Applesoft program as machine code, which BYTE's 1982 review noted was bought for improved execution speed or security of source code

Ampersand and USR extension packages

Because the interpreter's & statement jumps to a user-settable vector at $3F5, third-party commercial packages added new commands to Applesoft rather than waiting for Apple to change the ROM

Modern browser and emulator execution

Joshua Bell's Applesoft BASIC in JavaScript (on GitHub since 2013) runs listings in a web browser, and emulators such as AppleWin (v1.32.0.0, May 2026) run the original ROM interpreter

Learning to program on the Apple II

Applesoft was the language at the ] prompt of home and classroom Apple IIs, and Apple shipped tutorials for it for a decade, including A Touch of Applesoft BASIC (1986) for the IIe, IIc and IIGS

Language Influence

Influenced By

Microsoft BASIC Integer BASIC

Influenced

SmartBASIC

Running Today

Run examples using the official Docker image:

docker pull

Related Languages

Sources & Further Reading

Last updated: