Commodore 8-bit Basic
The family tree of BASICs in Commodore's 8-bit computers, from the PET's 1977 Microsoft-derived version 1 through the business line's 4.0+ and the C128's 7.0 to the unreleased Commodore 65's 10.0, traced through Commodore's own source code.
Created by Microsoft (6502 BASIC core), licensed and developed in-house by Commodore; later versions credit Fred Bowen and others at Commodore
Commodore 8-bit Basic is the family name for the BASIC interpreters that Commodore built into its 8-bit computers for roughly a decade and a half: the PET and CBM business machines, the VIC-20, the Commodore 64, the CBM-II line, the Commodore 16 and Plus/4, the Commodore 128, and the Commodore 65 that never shipped. All of them grow from one licensed copy of Microsoft’s BASIC for the 6502, which Commodore kept, patched, cut down and extended on its own for years.
Two related pages on this site cover parts of the same ground. CBM BASIC is an overview of the family’s shared language and its best-known versions, and Commodore 64 BASIC (V2) looks closely at the C64’s ROM. This page follows the family tree itself: which version came from which, and what each branch added. Most of it is taken from the change histories that Commodore’s programmers wrote at the top of their own source files, which Michael Steil has collected in the public cbmsrc archive.
History & Origins
The Microsoft licence
Microsoft wrote its BASIC for the MOS 6502 in 1976 as a port of its 8080 BASIC. Commodore, which had bought MOS Technology that year, licensed it for the machine that became the PET. The deal was a flat fee rather than a per-unit royalty; the figure usually quoted, $25,000, comes from Jack Tramiel’s recollection at a Computer History Museum event in 2007, not from a contemporary document.
Commodore’s copy became its own. The start-up screens of the PET, VIC-20, C64 and Plus/4 do not mention Microsoft at all. The C128 was the first to credit it, with the line (C)1977 MICROSOFT CORP. under the banner.
Versions 1 to 4, in Commodore’s own words
The PET BASIC 4 source listing, dated 23 July 1979, opens with a version history. It is the closest thing to an official chronology of the early family:
| Version | Date in the source | What the source says |
|---|---|---|
| 1 | August 1977 | “Original Microsoft release” |
| 2 | August 1978 | “Fixed many bugs”, including arrays limited to 255, non-interruptible code and string garbage collection |
| 3 | May 1979 | “Faster garbage collect” |
| 4 | July 1979 | “Expand reserved words”, “add disk commands”, “add disk status vars.” |
Commodore’s ROM genealogy bulletin uses the same numbers from the hardware side. It says the PET 2001 “first went into production in September 1977” with the ROM sets “known as BASIC 1.0”, followed by BASIC 2.0, BASIC 3.0 (which “allowed interfacing to the Commodore disk system”), BASIC 4.0 (which “added the Disk Commands to ROM and greatly improved the garbage collection”) and a corrective BASIC 4.1. Some later writers call the 1979 upgrade ROMs “BASIC 2”, so the numbering in secondary sources is not always consistent with Commodore’s.
The PET’s version 2 BASIC is reported to carry a hidden Microsoft signature: according to Michael Steil’s 2008 write-up of Microsoft’s 6502 BASIC Easter eggs, on a PET with the upgrade BASIC, WAIT 6502,1 prints MICROSOFT! at the top of the screen.
The business branch: 4X, 4.7, 4.73 and 4.0+
The business-machine BASIC kept its own history in the same comment block. The CBM-II source (listing dated 5 January 1984, headed “COMMODORE PET BASIC VERSION 4.0+”) continues the table:
- 4X, May 1980: “separate out KERNAL”, “set-up KERNAL interface”, “remove all KERNAL direct cell usage”. This is where BASIC stops poking at the operating system’s internals and goes through a defined interface instead.
- 4.7, October 1981: bank-related commands, literal strings copied to string space, an indirect input buffer and a vectored
CHRGOT. - 4.73, November 1981: a “64K version” with three-byte pointers, the third byte being a bank number, for strings and variables.
This became the BASIC of the CBM-II machines, which sign on with *** COMMODORE BASIC 128, V4.0 *** (or 64 or 256, depending on the model’s memory). Its token table goes well past the PET’s: DOPEN, DCLOSE, APPEND, CATALOG and the other disk commands, plus BANK, BLOAD, BSAVE, KEY, DELETE, ELSE, TRAP, RESUME, DISPOSE, PUDEF, PRINT USING, ERR$ and INSTR. Several of these features reached home users only years later in BASIC 3.5.
The archive also holds a “Commodore Business BASIC version 5”, dated 26 September 1979 in its own history, which merges BASIC 4 with the BASIC-AID programming tools and adds a decimal math package. Its listing is dated 16 July 1980. None of the sources consulted for this page shows it shipping in a production machine.
The home branch: V2 for the VIC-20 and C64
For its cheap home computers Commodore went back to a small BASIC. The VIC-20’s source calls itself “PET BASIC VERSION 2.1” and the C64’s “PET BASIC VERSION 2.2”, but both sign on as V2. Michael Steil, who reassembled the early Microsoft 6502 BASICs from a single source tree, argued in 2008 that this V2 is a PET BASIC 4.0 with the post-2.0 features stripped out for space, not a straight port of the 1978 PET version 2. The machines kept the small language: no disk commands, no graphics and no sound, even though the C64 had the VIC-II and SID chips. The C64’s BASIC ROM was never revised during the machine’s life, and a C64-mode copy of it (dated 31 May 1990) sits in the Commodore 65 sources.
BASIC 3.5: the TED machines
The Commodore 16 and Plus/4 of 1984, built around the TED chip, got BASIC 3.5. Its source is copyright 1984 and its start-up screen reads COMMODORE BASIC V3.5 followed by the number of bytes free. It kept the V2 keywords, in the same token order, and added a long list after them: ELSE, DO, LOOP, WHILE, UNTIL, EXIT, TRAP, RESUME, TRON, TROFF, AUTO, RENUMBER, DELETE, HELP, KEY, PRINT USING, the BASIC 4 disk commands such as DIRECTORY, DLOAD, DSAVE, SCRATCH, HEADER and COPY, graphics commands (GRAPHIC, COLOR, DRAW, BOX, CIRCLE, PAINT, CHAR, LOCATE, SCALE, SSHAPE, GSHAPE, SCNCLR), SOUND and VOL, the functions JOY, RDOT, RGR, RCLR, RLUM, DEC, HEX$, ERR$ and INSTR, and MONITOR for the built-in machine-language monitor.
BASIC 7.0: the Commodore 128
The C128’s BASIC 7.0 was built on the same base. Its main token table repeats BASIC 3.5’s list in the same order (without RLUM, since the C128 has no luminance control), and the later C65 source lists the C128 files it was adapted from, and they include doloop, trap, resume, renumber and the graphics files. It added keywords for the 128’s hardware, including SPRITE, MOVSPR, SPRDEF, SPRSAV, COLLISION, PLAY, ENVELOPE, FILTER, TEMPO, WINDOW, FAST, SLOW, BANK, FETCH, STASH, SWAP, BOOT, BEGIN/BEND and GO64, which switches to C64 mode and its BASIC V2. Most of these new keywords are two-byte “escape” tokens, because the one-byte token space was full.
The release notes inside the C128 source trace the last stretch: beta 5 on 5 March 1985 through beta 9 on 19 April, the production ROM 318020-03 on 8 May 1985, and a revised ROM set on 7 November 1986. The C128 start-up screen is:
| |
The 1986 ROMs change the Commodore line to (C)1986.
BASIC 10.0: the Commodore 65
The last member was written for the Commodore 65, a C64 successor Commodore developed around 1990–1991 and cancelled. Its source is headed “C65 Development BASIC 10.0 (C)1991 CBM”, gives the ROM version as 911115 (“ver 0.9B”), and says it was “written and assembled by Fred Bowen” and adapted from the C128 BASIC 7.0 files, ROM part numbers 318018-04 and 318019-04. It is marked for use “in prototype Commodore C/65 systems only”. Its sign-on brings back the Microsoft credit: COPYRIGHT 1977 MICROSOFT.
Commodore went bankrupt in 1994, and C64 production reportedly ended that April. No new machine with Commodore BASIC in ROM came from Commodore after the C128.
Design Philosophy
The family’s design comes from the combination of a portable Microsoft interpreter and Commodore’s hardware and operating system:
- BASIC is the user interface. Commodore’s 8-bit computers start up in BASIC at a
READY.prompt. Loading, saving and running programs, and on later versions managing disks, are BASIC commands. - I/O through the KERNAL. From version 4X onward the business BASIC was deliberately separated from the operating system and talked to it only through the KERNAL interface. The home machines used the same approach, which is a large part of why the language moved between machines with few changes.
- Compatibility by accretion. New versions kept the older keywords and token values and added new ones after them. A BASIC V2 program that avoids
PEEK,POKEandSYSusually runs on a Plus/4 or C128. The reverse is not true, and the extended token numbers differ between branches: the first token afterGOisCONCATin BASIC 4.0 butRGRin BASIC 3.5. - Machine code is expected.
PEEK,POKE,SYS,USRandWAITare in every version, and many programs combine BASIC with 6502 code.
Key Features
Features shared by the whole family
- Line-numbered programs, tokenised. Keywords are stored as one-byte tokens (BASIC 7.0 also uses two-byte escape tokens for many of its extra keywords), and keywords can be typed in abbreviated form, such as
?forPRINT. - Three variable types: floating-point reals,
%integers and$strings, with only the first two characters of a variable name significant. - The full-screen editor. You can move the cursor to any line on screen, change it and press RETURN. A line starting with a number is stored in the program; anything else runs at once.
- Device-numbered I/O.
OPEN,CLOSE,PRINT#,INPUT#,GET#andCMDwork with logical files on devices such as tape (1), printers (4) and disk drives (8 and up). - Clock and status variables.
TIandTI$read the jiffy clock andSTholds the I/O status.
Where the branches differ
| Version | Machines | Disk commands | Graphics / sound | Structured flow | Other additions |
|---|---|---|---|---|---|
| 1, 2 | PET 2001 | No | No | No | Commodore I/O statements, SYS |
| 4.0 / 4.1 | PET/CBM 4000, 8000 | Yes | No | No | DS, DS$ status variables |
| V2 | VIC-20, C64 | No | No | No | Cut down to fit the home machines |
| 4.0+ (4.7/4.73 lineage) | CBM-II | Yes | No | ELSE | PRINT USING, TRAP/RESUME, bank commands, INSTR |
| 3.5 | C16, Plus/4 | Yes | Yes | ELSE, DO/LOOP | MONITOR, RENUMBER, TRON, HELP, DEC/HEX$ |
| 7.0 | C128 | Yes | Yes, plus sprites | Also BEGIN/BEND | FAST/SLOW, GO64, SPRDEF |
| 10.0 | C65 (unreleased) | Yes | Yes | As 7.0 | Adapted from the C128 code for the C65 hardware |
The same program across the family
On BASIC V2 a loop with a test in the middle needs GOTO:
| |
On BASIC 3.5 and 7.0 it can be written with SCNCLR, DO/LOOP and ELSE:
| |
Both versions seed the random-number generator from the jiffy clock by passing a negative argument to RND, a common Commodore idiom.
Known weaknesses
The early versions inherited Microsoft’s slow string garbage collection, which the source history shows Commodore working on in versions 2, 3 and 4. The small V2 of the VIC-20 and C64 is widely reported to have kept a slow collector, and programs that create many strings can pause for long periods while it runs. BASIC V2 on the C64 also reports free memory above 32767 bytes as a negative number from FRE(0), because the function returns a signed integer and the C64’s 38,911 free bytes do not fit; BASIC 3.5 and 7.0 correct this. The C128 source adds patches for two more inherited faults, described in its comments as “the infamous INT(.9+.1) -> 0 Microsoft bug” and a PRINT USING bug with formats like $,999.99.
Evolution
The family grew as a tree rather than a line:
| |
The placement of V2 under version 4 follows Steil’s analysis; the CBM-II and V2 source headers both still call themselves “PET BASIC”. The link from 3.5 to 7.0 rests on the shared keyword set and the C128 source files that the C65 later names; the sources consulted do not spell out the TED-to-C128 derivation in a change history.
Current Relevance
No hardware with Commodore BASIC in ROM has been made by Commodore since 1994, but every branch can still be used:
- Emulation. The VICE emulator covers the PET, VIC-20, C64, C128, Plus/4 and CBM-II families and runs the original ROM images.
- Source code. Michael Steil’s
cbmsrcarchive has Commodore’s original sources for PET BASIC 4, the CBM-II BASIC in three dated revisions, VIC-20 and C64 BASIC V2, BASIC 3.5, both C128 BASIC 7.0 ROM sets and C65 BASIC 10.0. In September 2025 Microsoft published its own 6502 BASIC 1.1 source, including the Commodore target, under the MIT License. - cbmbasic. Steil’s 2008 recompilation of C64 BASIC V2 to C runs
.basprograms from a Unix or Windows command line. - MEGA65. The FPGA-based MEGA65 runs BASIC 65, a continuation of the Commodore 65’s BASIC 10, so the last branch of the tree has hardware to run on.
Why It Matters
For a very large number of people, the READY. prompt of a Commodore machine was their first programming environment, and the family’s history explains why that environment differed so much from machine to machine. Commodore had disk commands in 1979, ELSE, TRAP and PRINT USING in its business BASIC by the early 1980s, and graphics and structured loops in 1984, yet its best-selling machine shipped with the small V2 and never got an update. Owners of the C64 learned POKE and machine code, and a market of BASIC extensions filled the gap, while owners of a Plus/4 or C128 could draw a circle with one command.
The family is also an unusually well-documented example of how licensed software evolved in the 8-bit era. Commodore’s programmers wrote the history into the top of each source file, from the “original Microsoft release” of August 1977 to Fred Bowen’s C65 BASIC of 1991, and those comments now make it possible to follow a single 1976 codebase through fifteen years and most of Commodore’s 8-bit product line.
Timeline
Notable Uses & Legacy
PET and CBM business computers
BASIC 4.0 put disk commands such as DLOAD, DSAVE, DIRECTORY and SCRATCH into the language on the PET/CBM 4000 and 8000 series, and the CBM-II line added PRINT USING, TRAP/RESUME and bank-switching commands for larger business machines
Home programming on the VIC-20 and Commodore 64
BASIC V2 was the power-up environment of the two best-selling Commodore machines, and magazines such as COMPUTE!'s Gazette printed BASIC listings for readers to type in
Loading and launching software
Commodore 8-bit machines boot into BASIC, so loading a program meant typing LOAD and RUN. Many commercial programs began with a short BASIC line that used SYS to jump into machine code
Graphics and sound on the Plus/4 and C128
BASIC 3.5 and 7.0 gave the TED-based machines and the C128 keywords such as GRAPHIC, DRAW, CIRCLE, PAINT and SOUND, and the C128 added SPRITE, MOVSPR, PLAY and the SPRDEF sprite editor
MEGA65
The FPGA-based MEGA65 computer runs BASIC 65, which continues the unreleased Commodore 65's BASIC 10
cbmbasic
Michael Steil's 2008 static recompilation of Commodore 64 BASIC V2 to C runs the original interpreter as a command-line tool on modern operating systems