Est. 1980 Beginner

Commodore Basic V2

The small BASIC that Commodore put in the VIC-20 and then, almost unchanged, in the Commodore 64: one 8 KB interpreter with no graphics or sound keywords, shared across two of the best-selling home computers of the early 1980s.

Created by Microsoft (6502 BASIC core), adapted by Commodore Business Machines; the change notes in Commodore's source are signed RSR

Paradigm Procedural (line-numbered, unstructured BASIC)
Typing Dynamic, weak; floating-point reals, % integers and $ strings
First Appeared 1980
Latest Version V2.2 in Commodore's source numbering (Commodore 64 BASIC ROM 901226-01, 1982)

Commodore Basic V2 is the BASIC that Commodore built into its two big home computers of the early 1980s, the VIC-20 and the Commodore 64. On the VIC-20 the machine announced it plainly:

1
2
3
4
**** CBM BASIC V2 ****
3583 BYTES FREE

READY.

It is a small language even by the standards of its day. It has no keywords for colour, graphics, sound, joysticks or disk management, no ELSE, and no tools for renumbering or tracing a program. What it did have was size and sameness: the whole interpreter fits in 8 KB of ROM, and the VIC-20 and C64 versions accept exactly the same keywords.

The encyclopedia lists the C64’s ROM separately as Commodore 64 BASIC (V2), and that page covers the C64 in detail. This page treats V2 as a dialect shared between machines: where the name comes from, how it started on the VIC-20, and what actually changed when it moved to the C64. The wider family is covered under CBM BASIC and Commodore 8-bit Basic.

What “V2” refers to

Three different things are called version 2 in Commodore’s BASIC history, and they are easy to confuse.

NameMachinesWhat the source or ROM calls itself
PET BASIC version 2PET 2001 upgrade ROMs“COMMODORE PET BASIC VERSION 2”, copyright 1978 (in a reconstructed source); sign-on ### COMMODORE BASIC ###
V2 as sold on the VIC-20VIC-1001, VIC-20“PET BASIC VERSION 2.1”; sign-on **** CBM BASIC V2 ****
V2 as sold on the C64Commodore 64 and its variants“PET BASIC VERSION 2.2”; sign-on **** COMMODORE 64 BASIC V2 ****

The first row is the namesake. Commodore’s own version history, kept as a comment at the top of its BASIC source, dates version 2 to August 1978 and says it “fixed many bugs”, among them arrays limited to 255 elements and string garbage collection. The notes that accompany Michael Steil’s cbmsrc source archive say Microsoft built this version itself and called it 1.1. In a 2008 article Steil wrote that Commodore began shipping it as update ROMs for existing PETs in 1979. It never printed “V2” on the screen.

The second and third rows are the subject of this page. They are the only Commodore BASICs that sign on as V2, and they are nearly the same program.

The year

The master list this page was created from gives 1982, which is the year of the Commodore 64. The dialect is older than that. The change notes in the VIC-20 source begin in August 1980, the VIC-20 was sold in the United States during 1981, and its 1981 manual already prints the CBM BASIC V2 banner. This page therefore uses 1980, the year the machine was announced and, according to Commodore’s press release, was due to go on sale in Japan as the VIC 1001. One caution: the VIC-20 source that survives includes a fix dated March 1981, so it is later than the first Japanese units, and none of the sources consulted here shows what those first units displayed at power-up.

History & Origins

A Microsoft core

Every Commodore 8-bit BASIC descends from Microsoft’s BASIC for the MOS 6502, which Commodore licensed for the PET, in October 1976 according to Michael Steil’s history of the interpreter. BYTE’s May 1981 review of the VIC-20 described the result in one sentence: “VIC BASIC is a version of Microsoft BASIC modified by Commodore.” Microsoft is not named in the VIC-20 or C64 BASIC source. The VIC-20 header reads “COPYRIGHT (C) 1981 BY COMMODORE BUSINESS MACHINES”.

Vixen

Commodore announced the VIC 20 in a press release dated 30 September 1980. Among the listed features was “standard PETBASIC”. The release said the machine had been introduced in Tokyo in mid-September as the VIC 1001, would go on sale in Japan in October, and would reach the United States in the first quarter of 1981.

The BASIC source for the VIC-20 (ROM 901486-01) is in the cbmsrc archive. Its comments use the project’s code name: the ROM location is labelled “VIXEN ROM” and the 22-column setting “VIXEN SCREEN SIZE”. The change notes at the end of the files are signed with three initials:

  • RSR 8/10/80: “CHANGE SYS COMMAND”
  • RSR 8/26/80: “ADD OPEN&CLOSE MEMSIZ DETECT”
  • RSR 10/7/80: “CHANGE LOAD (REMOVE RUN WAIT)”
  • RSR 3/06/81: “FIX PROGRAM LOAD FOR OFFSET PROGRAMS”

RSR is most likely Robert Russell, who is generally credited with porting the KERNAL and BASIC to the VIC-20, but the listing never spells the name out.

The header of the same source is dated “06 MARCH 1980” while carrying a 1981 copyright and the note dated 6 March 1981. The year in the listing date looks like a slip, although the source does not say so.

Why a small BASIC

By 1980 Commodore already had BASIC 4.0 on its PET and CBM business machines, with disk commands in the language. The VIC-20 did not get it. The machine shipped with about 5 KB of RAM and was meant to be cheap, and V2 fits in a single 8 KB ROM.

BYTE’s reviewer, Gregg Williams, saw the lack of new keywords as a deliberate advantage. Colour, graphics and sound were all reached through control characters and POKE, so “VIC programs are syntactically equivalent to PET programs”, and programs could be moved between the machines “without syntax errors due to unrecognized keywords”. He added that Commodore had probably developed VIC BASIC faster and more cheaply because of its similarity to PET BASIC.

Not a port of PET BASIC 2

The obvious reading of the name is that Commodore took the PET’s version 2 and moved it to the VIC-20. Michael Steil, who reconstructed the early Microsoft 6502 BASICs from a common source tree, argued otherwise in 2008: “the BASIC V2 used on the VIC-20 and the C64 is actually a stripped-down version of PET BASIC 4.0 and not a ported version of PET BASIC V2”. In a follow-up article he described it as the 4.0 source “with all post-2.0 features stripped out again for space reasons”, and pointed to two inherited details: it ends lines with a carriage return alone, and it asks the KERNAL for the memory size instead of testing memory itself.

Commodore’s source supports the first of those details directly. The routine that ends a printed line sends a carriage return and then a line feed in the PET version 2 code. In the VIC-20 code it sends the carriage return and then checks the output channel, as the BASIC 4 listing of July 1979 does.

What was stripped out included BASIC 4’s rewritten string garbage collector. The collector in the VIC-20 source matches the older PET version 2 routine, while the BASIC 4 listing keeps its newer collector in a separate file. This is the origin of the long pauses that V2 programs suffer when they create many strings.

From the VIC-20 to the Commodore 64

The Commodore 64 was developed under the code name VIC-40, and its BASIC (ROM 901226-01) is the VIC-20’s with a short list of changes. Comparing the two sets of source files, nine of the 33 differ, most by a few lines:

ChangeVIC-20 (2.1)Commodore 64 (2.2)
ROM address$C000 (“VIXEN ROM”)$A000 (“VIC-40 BASIC ROM”)
Screen width constant2240
Width of a PRINT comma zone1110
Text before ERROR in messagesa carriage return, “for VIXEN screen”a space, “for VIC-40 screen”
Start of zero pageBASIC’s USR jumpreserved for the 6510’s I/O register
Sign-on**** CBM BASIC V2 ******** COMMODORE 64 BASIC V2 ****
Program-load fixa patch routine added in March 1981the same fix moved inline (10 April 1982)
PRINT#calls the KERNAL directlygoes through a patch added on 2 July 1982

The C64 code also no longer fits in one ROM: its tail continues at $E000, in the chip that holds the KERNAL. The keyword and token tables are identical in the two versions.

The header of the C64 source lists the machines the code was meant for: the PETs, an unexplained “TOY”, the “VIC-20/VIC-40”, the “COMMODORE 10/16/64” and the MAX.

Design Philosophy

V2 was adapted for its machines, not designed around them:

  • Small first. The interpreter was cut to fit 8 KB. Features Commodore already had in BASIC 4.0 were left out.
  • One language, several machines. The same keywords work on the PET, the VIC-20 and the C64. What differs between machines is the memory map, not the language.
  • BASIC is the user interface. There is no separate command line. Loading, saving and running programs are BASIC statements typed at the READY. prompt.
  • Input and output go through the KERNAL. BASIC calls the operating system’s jump table for the screen, keyboard, tape, serial bus and RS-232, which probably helped when it was moved to a new machine: the source lists only a handful of changes for the C64.
  • Hardware is reached through memory. PEEK, POKE, SYS, USR and WAIT are the only route to the video and sound chips.

Key Features

Keywords

The token table defines 76 one-byte tokens, from END to GO.

GroupKeywords
Program flowFOR/TO/STEP/NEXT, GOTO, GOSUB/RETURN, ON...GOTO/GOSUB, IF...THEN, END, STOP, CONT, RUN, REM
Data and memoryLET, DIM, READ, DATA, RESTORE, DEF FN, CLR, NEW, LIST, FRE
Console I/OPRINT, INPUT, GET, TAB(, SPC(, POS
Devices and filesLOAD, SAVE, VERIFY, OPEN, CLOSE, PRINT#, INPUT#, GET#, CMD
HardwarePEEK, POKE, SYS, USR, WAIT
MathABS, ATN, COS, EXP, INT, LOG, RND, SGN, SIN, SQR, TAN
StringsLEN, LEFT$, RIGHT$, MID$, STR$, VAL, ASC, CHR$

The reserved variables ST, TI and TI$ give the I/O status and the jiffy clock. Keywords can be abbreviated when typing; the VIC-20 manual explains that ? stands for PRINT and that most others are the first letter or two followed by a shifted letter. LIST always shows the full keyword.

Data types

  • Floating-point numbers. The VIC 20 Programmer’s Reference Guide says numbers are stored “to over ten digits of accuracy” and printed with nine.
  • Integers, written with a % suffix.
  • Strings, written with a $ suffix.
  • Only the first two characters of a variable name are significant.

The same language in different memory

A V2 program that uses only BASIC statements usually runs on either machine. The differences are in the numbers around it:

Unexpanded VIC-20Commodore 64
Free memory at power-up3583 bytes38911 bytes
Screen22 columns by 23 rows40 columns by 25 rows
Longest program line88 characters (four screen rows)80 characters (two screen rows)
BASIC ROM$C000-$DFFF$A000-$BFFF, continuing at $E000

On the VIC-20 even the start of a BASIC program depends on the hardware. According to the Programmer’s Reference Guide, an unexpanded machine starts BASIC at 4096 with the screen at 7680. Adding 3 KB moves the start of BASIC down to 1024. Adding 8 KB or more moves it to 4608 and moves the screen to 4096. Programs that POKE characters to the screen had to work out where the screen was first.

Colour and sound by POKE

Because the language has no hardware keywords, the same idea is written with different addresses on each machine. On the VIC-20, one register at 36879 sets both the screen and border colours, and the sound registers follow just below it:

1
2
3
4
5
10 POKE 36879,8:REM BLACK SCREEN AND BORDER
20 POKE 36878,15:REM VOLUME, 0 TO 15
30 POKE 36876,225:REM START A TONE ON THE HIGHEST VOICE
40 FOR T=1 TO 300:NEXT
50 POKE 36876,0:REM SILENCE

On the Commodore 64 the border and background are separate registers, and sound goes through the SID chip at 54272:

1
10 POKE 53280,0:POKE 53281,0:REM BLACK BORDER AND BACKGROUND

Colours for text are simpler. Both machines accept colour and cursor-control characters inside PRINT strings, which is why BYTE could say the VIC needed no new keywords for them.

Extending it: the Super Expander

Commodore’s answer to the missing commands on the VIC-20 was a cartridge. The Super Expander manual lists what it adds: GRAPHIC, COLOR, REGION, POINT, DRAW, CIRCLE, PAINT, CHAR and SCNCLR for graphics, SOUND and a music mode entered from PRINT strings, the read functions RGR, RCOLR, RDOT, RSND, RPOT, RPEN and RJOY, and KEY for the function keys. It also supplies 3 KB of extra RAM. A Super Expander 64 and Simons’ BASIC did the same job for the C64. Several of these keyword names came back later inside the ROM in BASIC 3.5.

Known Weaknesses

Garbage collection. V2 has the older string garbage collector, not BASIC 4’s. Programs that build and discard many strings can stop for long periods while it runs. No timing is given here because the delay depends entirely on how many strings a program holds.

The multiplication bug. In December 2013, members of the Denial VIC-20 forum found an arithmetic fault in the V2 ROM, in a thread that began on 8 December. A shortcut in the floating-point multiply routine mishandles a carry, so that for some operands the result depends on the order of multiplication:

1
2
A=.75+59E-9
PRINT A*1E9-7.5E8, 1E9*A-7.5E8

Both columns should show 59. The forum reported 59 and 29.5 on an unpatched VIC-20. The forum member Mike traced it on 31 December 2013 and posted a patched VIC-20 ROM the next day. The same code is in the C64, and a C64 patch followed on 19 January 2014. The fault is not peculiar to V2: according to the same thread, the Commodore 16, Plus/4 and the BASIC 4 PETs give the same wrong answer.

Bugs inherited from Microsoft. Steil’s comparison of Microsoft 6502 BASIC versions notes faults that were never fixed in any of them, such as a faulty check on very large line numbers. He also notes one that Commodore did fix “at least as early as for the VIC-20 in 1980”: a pair of random-number constants that were a byte too short.

Evolution

V2 itself barely changed. The work on it ran from August 1980 to July 1982, and after that the C64’s BASIC ROM was never revised.

  • MAX Machine (1982). The source archive contains reconstructions of two BASIC cartridges for this Japanese cousin of the C64. One is a slightly patched C64 BASIC. The other, MINI BASIC, is described there as a stripped-down version with no arrays and no trigonometry. Both reconstructions sign on as **** CBM BASIC V2 ****.
  • BASIC 3.5 (1984) and 7.0 (1985). The Commodore 16, Plus/4 and Commodore 128 kept the V2 keywords with the same token values and added graphics, sound, disk and structured-loop commands after them. The C128 also kept V2 itself for its C64 mode, reached with GO64.
  • Late copies. The 1990 Commodore 64 Games System still carries BASIC V2; the archive’s notes say its binary differs from the ordinary C64 BASIC only in one entry of BASIC’s vector table, which sends the main loop to the console’s power-on message, and the checksum byte. The sources for the unreleased Commodore 65 include a C64-mode BASIC V2 whose changes are tagged 31 May 1990, under a header that carries a 1991 copyright.

Current Relevance

Neither machine has been made for decades. The VIC-20 was reportedly discontinued in January 1985 and C64 production reportedly ended in April 1994. V2 is still easy to run and to study:

  • Emulation. VICE emulates both the VIC-20 and the C64 and runs the original ROM images, so each machine still starts at its own V2 banner.
  • Source code. Commodore’s original source for both versions is public in the mist64/cbmsrc archive, including the RSR change notes quoted above. In September 2025 Microsoft published its own 6502 BASIC source, the ancestor of the whole Commodore line, under the MIT License.
  • cbmbasic. Steil’s 2008 recompilation of the C64 ROM runs V2 programs from a modern command line.
  • Hobbyist use. The VIC-20 and C64 both keep hobbyist communities. The 2013 multiplication bug was found on one of them, the Denial VIC-20 forum, more than thirty years after the ROM was written.

Why It Matters

V2 is a study in what a deliberately small language does to its users. Commodore chose an old, compact BASIC for a cheap machine, then reused it on a much more capable one because it was known, it fitted, and existing programs would run. The first choice made sense for a computer with 5 KB of RAM. The second left the Commodore 64 with sprites and a synthesiser chip that its own BASIC could not name. Owners of both machines learned memory addresses, and many of them went from POKE to machine code.

It also shows how little separated two famous computers at the software level. The BASIC that greeted VIC-20 owners in 1981 and the one that greeted C64 owners for the next twelve years differ by a ROM address, a screen width, a banner and two patches.

Timeline

1978
Commodore's source history dates PET BASIC version 2 to August 1978. This earlier "version 2", built by Microsoft and shipped as upgrade ROMs for the PET, shares the number but signs on as ### COMMODORE BASIC ###, not as V2
1980
Change notes signed RSR in the VIC-20 BASIC source record work on 10 August, 26 August and 7 October 1980. A Commodore press release of 30 September announces the VIC 20 with "standard PETBASIC" and says the Japanese model, the VIC 1001, will go on sale in October
1981
The VIC-20 goes on sale in the United States at $299.95. A final change note dated 6 March 1981 fixes program loading, the 1981 owner's manual shows the CBM BASIC V2 start-up screen with 3583 bytes free, and BYTE reviews the machine in May
1982
The same BASIC is adapted for the Commodore 64. Its source, headed PET BASIC version 2.2 and dated 10 April 1982, adds a VIC-40 modification (8 February), the COMMODORE 64 BASIC V2 sign-on (15 April) and a PRINT# patch (2 July)
1982
Commodore publishes the VIC 20 Programmer's Reference Guide and a Super Expander cartridge manual, both copyright 1982. The Super Expander adds graphics, music and joystick keywords on top of V2
1984
The Commodore 16 and Plus/4 ship with BASIC 3.5, which keeps the V2 keywords with the same token values and adds graphics, sound and structured-loop commands after them
1985
The Commodore 128 ships with BASIC 7.0 and a GO64 command that switches to Commodore 64 mode and its BASIC V2
1990
Fred Bowen's source for the Commodore 64 Games System still contains BASIC V2; according to the source archive's notes, the binary differs from the ordinary C64 BASIC only in one entry of BASIC's vector table and the checksum byte
2008
Michael Steil writes that the V2 in the VIC-20 and C64 is a cut-down PET BASIC 4.0 and not a port of PET BASIC 2, and on 28 October releases cbmbasic, a recompilation of the C64 ROM to portable C
2013
On 31 December a member of the Denial VIC-20 forum traces a floating-point multiplication bug in the V2 ROM. Patches follow for the VIC-20 on 1 January 2014 and for the C64 on 19 January 2014

Notable Uses & Legacy

Commodore VIC-20

V2 was the power-up environment of the VIC-20. Its 1981 owner's manual, Personal Computing on the VIC-20, teaches programming from the CBM BASIC V2 prompt with 3583 bytes free

Commodore 64

The C64 used the same interpreter, relocated and given a new banner. Because the keyword set was identical, BASIC programs that avoided PEEK and POKE could move between the two machines

Type-in programs

Magazines such as COMPUTE!'s Gazette, which began in July 1983 and covered both the VIC-20 and the C64, printed V2 listings for readers to type in, often with machine code in DATA statements

Super Expander cartridge (VIC-1211A)

Commodore's own extension for the VIC-20 added keywords such as GRAPHIC, COLOR, DRAW, CIRCLE, PAINT and SOUND, read functions such as RJOY and RPEN, and 3 KB of RAM, all layered on the V2 in ROM

MAX Machine BASIC cartridges

The source archive reconstructs two cartridges for Commodore's MAX Machine from the C64 code: a lightly patched BASIC, and a cut-down MINI BASIC without arrays or trigonometry. Both reconstructions sign on as CBM BASIC V2

cbmbasic

Michael Steil's 2008 recompilation of the C64 BASIC V2 ROM to C runs the original interpreter as a command-line tool on current operating systems

Language Influence

Influenced By

Microsoft BASIC CBM BASIC

Influenced

Commodore BASIC 3.5 Commodore BASIC 7.0

Running Today

Run examples using the official Docker image:

docker pull
Last updated: