Commodore Basic

The BASIC included with the CommodoreSixtyFour, CommodoreVicTwenty, and other Commodore machines was more or less the same. Even programs for the old CommodorePet machines could often run without modification on the 64.

It had some interesting attributes:

Variable names were limited to two letters. Or, specifically, any variable name longer than two characters was truncated, so that MARKUP and MAINTOTAL would both point to a single variable named MA.

Can somebody confirm this? IIRC, the C64 could handle longer variable names, but it's a long time ago so I could be wrong.

Correct, the first two letters of a variable name must be unique. Also, your example variable MAINTOTAL contains the reserved word INT which would produce a ?SYNTAX ERROR. --CarstenKlapp

Arrays can have up to 255 dimensions, each with up to 32767 elements. The practical limitation was almost always available RAM or the 80 character logical screen line.

However spaces were not necessary between symbols; the tokenizer just grabbed what it could find before passing it to the interpreter.

  10 FORX=1TO200:NEXTX
  20 GETA$:IFA$=""THEN20
  30 PRINTA$:IFX<2THENGOSUB500:SYS49152

This was not only common, but encouraged, since whitespace took up valuable memory, and also detracted from the number of statements you could fit on a single line.

To save even more memory and time, one could write a "pretokenized" program. Any key word could be specified by its two-letter equivalent. Thus the PRINT statement would be written as "P[SHIFT-R]", LOAD as "L[SHIFT-O]" etc. When working in uppercase display mode, toggled by pressing Commodore-SHIFT (written as C= SHIFT), the second letter of these "shifted" key words would display as boxes, lines and other graphics characters. An experienced programmer would eventually learn to recognize these tokens on sight and could read a program LIST on screen or printed out without shifting into lowercase display mode.

Actually, since tokens were stored in memory as single bytes, they were always expanded to their full name. Therefore, a line would expand beyond 80 characters and the screen editor could no longer be used to modify it.

I know of one 3D Labyrinth program in Compute! Gazette, which boasted that it would run on both the Vic-20 and Commodore 64, but in order to get it to run on an unexpanded 3K Vic, you had to type it with no whitespace whatsoever.

Magazines also featured a monthly "one liner" and "two liner" contests. In order to fit on one line (80 characters), most one-liner programs were written entirely in shifted notation. Writing this kind of program was especially challenging because it precluded any use of GOTO and GOSUB.


There were some really cool extensions added for the CommodoreOneTwentyEight. It had a PLAY statement, where you typed PLAY followed by a string of notes, and it would play those notes. You could have up to three different "channels" playing simultaneously (I think Commodore called them 'voices'). -- EddieDeyo

Commands like these were commonly built-in to the BASICs that came with other machines like the AppleIi and AtariComputer?. There was a program in ComputeGazette? that claimed to enhance CommodoreBasic with commands that resembled those in AtariBasic, like PLOT, DRAWTO, etc.

The BASIC that came with my old Tandy 1000 HX (7 MHz 8088 CPU) also had the PLAY statement, and the Tandy had built-in 3 voice sound support. It was actually pretty good sound, compared to the standard PC speaker shipped with most computers at the time. -- BrianRogers


Versions of CommodoreBasic:

CommodorePet: V1.0, V1.2, V4.0
CommodoreSixtyFour: V2
CommodoreVicTwenty: V2
CommodorePlusFour: V3.5
CommodoreOneTwentyEight: V7.0?

The 64 and VIC20 got V2 while the PETs had V4.0 because the PET was Commodore's professional line and programming for the lesser machines wasn't expected to be as popular (HA)


There are a number of CommodoreEmulators? but my favorite is Power64. It features a complete SID (sound) and MOS 6510 CPU Emulation, including the Illegal Opcodes! --CarstenKlapp <http://www.salto.at/Power64/index.html>

There's another emulator called VICE which emulates the C64, 128, Vic-20 and Pet. http://vice-emu.sourceforge.net/

Project 64 attempts to preserve Commodore64 related documentation. A wide variety of texts about hardware (both original Commodore and third party) and software is available. <http://project64.c64.org/>


The Power 64 docs also contain a guide to the C64's Basic at: http://www.infinite-loop.at/Power64/Documentation/Power64-ReadMe/AA-C64_BASIC.html. So those of us who had almost forgotten it can wallow in nostalgia.--AdewaleOshineye


Commodore sold two expanded BASIC cartridges for the VIC-20: the Super Expander, which included a 3K RAM expansion, and the Programmer's Aid cartridge.

The Super Expander added graphics and sound commands as well as the ability to attach string "macros" to the function keys. If you look at the design of the VIC-20, it's apparent that the 3K memory bank the Super Expander adds was cut from the production model (which shipped with 5K of relatively expensive static RAM) as a cost-saving measure. The graphics and sound commands may have also originally been intended to ship with the VIC.


http://10print.org/ interesting book on 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 if you are interested in that sort of thing (free to read PDF)


See also SimonsBasic, EightBitBasic?


EditText of this page (last edited October 11, 2014) or FindPage with title or text search