Commodore‎ > ‎

BASIC

This section of my site is a comprehensive encyclopedia -- a nearly complete Commodore BASIC Reference.  It is for official/production relases of V1, V2, V3.5, V4, and V7.  It is not 100% complete because some never-released prototype versions (like V3.6 of the C=LCD or V10.0 of the C=65) are missing.  Anyway, lets begin with some background information...
 
 
BASIC History  
BASIC is an easy-to-use programming language.  The word BASIC is an acronym for Beginner's All-purpose Symbolic Instruction Code.  It was developed at Dartmouth College in 1964.  See this wikipedia article for more information about generic (non-Commodore) BASIC.
 
Microsoft implemented BASIC on a variety of 8-bit CPUs beginning 1976 (here is an interesting timeline / reconstruction).  One source says they wrote it in 1975.  Sometime in the late 1970s, Commodore purchased the rights to 6502-based BASIC from Microsoft. Commodore got a good deal, as the story goes, because they paid a flat fee (in stead of per-machine fee) and they were also able to freely modify it and never had to mention Microsoft.  It wasn't until 1985 before the name Microsoft showed up on CBM machines.  Legend says this is because Commodore wanted a 680x0 (Motorola CPU) version of BASIC for their Amiga line, so they had to re-negotiate with Microsoft who appearantly insisted on their name being shown in new versions.  Anyway, Commodore customized the version they got from Microsoft, resulting in Commodore BASIC, or CBM BASIC for short.
 
Unlike most "big computers", but like many (most?) of the home computers of the 1980's, CBM BASIC is built into ROM and starts by default when the computer is turned on.  The BASIC interpreter is actually the user-interface portion of the operating system (OS) on all 8-bit CBM machines.  A lower-level part of the OS, called the KERNAL, exists on the CBM 8-bit computers (it is similar to the BIOS on modern PCs).
 
 
BASIC Versions  
Over the years, several versions of BASIC were released by Commodore for their various machines.  Here is a quote from Commodore's BASIC 4.0 User's Manual (copyright 1980):

The first Commodore BASIC, version 2.0, was released in August 1977 for the PET 2001-8 computer.  Version 3.0 in July 1978 added a machine language monitor and corrected known bugs of version 2.0... Version 4.0, completed in October 1979 included all the improvements of previous releases, enhanced the speed of string processing, and integrated disk commands into the BASIC language.

Strangely they fail to mention version 1.0 which is known to exist on some PETs.  In fact later in the same manual they refer to version 1.0 many times!  Perhaps version 1.0 was not Commodore BASIC ?? On the other hand, I have never seen version 3.0 (that doesn't mean it doesn't exist, but it seems to be rare).  Anyway, each higher version number is generally upward compatible with the previous.  That is, newer versions generally support all the keywords of the older versions plus add new ones.  Unfortunately there are some exceptions.  Most notably from version 3.5 which has many more keywords than version 4.x (4.0 or 4.7).  However v3.5 is missing some disk-based commands that are available in v4.x.  I think v3.5 should instead have been called version 5.0, but that's me!

 
While the "source code" format is completely compatible with this versioning scheme, the "object code" has serious problems with the disk-based commands.  The "source code" refers to the program in text format (use LIST to see the "source code"), while "object code" refers to the raw binary files that store them.  The file format is actually completely compatible, but most keywords of the text version are "compressed" into a 1-byte (occassionally 2-byte) token.  It is the tokens for some disk-based commands that are incompatible between some versions.
 
Following is the list of known BASICs from the various machines released by Commodore.  This does not include any of several BASIC extensions made by other parties (like Simon's BASIC or BASIC 8), or from unreleased products of Commodore (such as the C=LCD, or C=65).  They are listed, mainly, by order of release.
  • v1.0 found in the first PET model(s)
  • v2.0 found in many PET models
  • v2.1 found in VIC-20 and C=64
  • v4.0 found in later PET models
  • v4.7 found in CBM-II models
  • v3.5 found in Plus/4 and C=16
  • v7.0 found in C=128
With the exception of v3.5 and v7.0, any version number fraction (such as v2.1) is controversial because Commodore generally never gave a fractional value (sub-version).  When they did, discrepencies can be found.  For example, the CBM-II models say v4.0 on start-up, although it can be simply demonstrated that it differs from v4.0 found on the earlier PETs.  (This is because the CBM-II series really have v4.7 and not v4.0 like the start-up screen says!) 

In other words, Commodore wasn't very serious about version numbers so controversy and confussion should be expected!  So BASIC of the Commodore 64 is considered by many to be v2.0 even though Commodore usually only said version 2 (no dot zero).  I refer to C64/VIC-20 BASIC as v2.1 (because there are "tweaks" compared to old PET machines of v2.0).  Anyway, there are fanatics that will strongly argue about such trivial things, so I thought I should warn you.

  More Details...  

There are a lot more details than would confortably fit on this page. So there are several sub-pages:

Other pages of my site have information that may be useful for a BASIC programmer:


  Outside Links  
Although I'm confident you'll find my BASIC Encyclopedia the most comprehensive Commodore BASIC reference on the web, below are some links that may interest you.  They may provide machine-specific information, more/better examples, or other cool stuff.
 
http://www.c64-wiki.com/index.php/BASIC only covers v2; specific to C64 in that it lists the address in ROM of BASIC routines
http://www.lemon64.com/manual/ HTML version of C64 user guide by CBM (so missing important details!); specific to the C64; includes D64 of all examples!
http://www.commodore.ca/manuals/128_system_guide/toc.htm HTML version of C128 user guide by CBM (so missing important details!); specific to C128
http://www.c64-wiki.de/index.php/BASIC nice German version; includes all versions up to 7.0, although it is missing several keywords
http://plus4world.powweb.com/kb.php?cat=490041 covers version 3.5, for Plus/4 and C=16, only missing a few keywords (mostly operators)
http://cbmbasic.sourceforge.net/ has a v2 scripting language for your Linux / Mac / Windows PC !
http://www.softwolves.pp.se/cbm/artiklar/usr.en.html an article devoted to a single function: USR
http://scacom.bplaced.net/Collection/basicen.php very brief overview of the versions of CBM BASIC; includes some screen shots
http://www.ffd2.com/fridge/docs/c64-diss.html is a disassembly of the C64's BASIC ROM
 
  BASIC Extensiosns  
This page (and set of sub-pages) is about official released versions of CBM BASIC.  However, several extensions to BASIC have been released by various entities.  Here are the main ones (my opinion, of course):
 
https://archive.org/stream/SimonsBASIC/Simons_BASIC_djvu.txt contains the text of Simon's BASIC (adds over 100 commands); popular extension for C64
http://en.wikipedia.org/wiki/BASIC_8 talks about the 80-column bitmap commands by Walrusoft
https://sites.google.com/site/h2obsession/CBM/C128/basic7-80 is my own 80-column bitmap extension for the C128
http://www.members.tripod.com/the-cbm-files/speak/samdoc.txt notes about Software Activate Mouth (SAM) for the C64 [better link needed!]
 

© H2Obsession, 2014, 2015