Commodore BASIC

Commodore BASIC is a dialect of the BASIC programming language used in Commodore 8- bit home computers - was used - beginning in 1977 with the PET 2001 to C128 in 1985. Later, an imaginary for the C65 version was added, which was not more complete. The Basic was based on 6502 Microsoft BASIC, which was licensed by Microsoft for a single payment. Some other BASICs for 6502 computer, for example Applesoft BASIC, is based on the same code base and are therefore very similar.

Special Features

One particular from the perspective of the time advantage of the built- in ROM Commodore BASIC interpreter compared to those of other manufacturers was built, called "Full Screen Editor " ( "full screen editor " ) supported by a comfortable editing programs or run immediately commands allowed without cumbersome EDIT commands, copy- cursor functions, ESCAPE key sequences or other detours. The editor could also connect multiple screen lines to a program line; the maximum usable number of screen lines per program line was model-dependent. Program lines by pressing the enter key ( "Return" ) partially compiled - Keywords found translated the editor in token of a one byte payload - and then stored in memory by row number in the correct position in the concatenated list of lines. In the output of the program using LIST these tokens are expanded again.

In the first versions of the system was strongly oriented cassettes. The interpreter contains features for controlling the "Commodore Datassette ".

Commodore BASIC uses line numbers in the range 0 to 63999th commands for structured programming were virtually non-existent in the first versions. The program flow control is done by the commands GOTO, GOSUB / RETURN, IF ... THEN ( without ELSE) and ON ... GOTO / GOSUB ON ... who expect each line numbers as the jump destination. Only the loop command FOR / NEXT was a reasonably structured statement.

Known data types are 40 - bit floating-point, 16 -bit integers and strings of variable length up to 255 characters. Simple variables need not be declared; they begin to exist when they are used. They are named with a letter or a letter followed by another letter or number; more alphanumeric characters can follow, but will be ignored, so that, for example, LAUGHING and LABER denote the same variable LA. Thus, most programs generally do not use variable names longer than two characters in length. The suffixes $ (dollar sign ) and% (percent sign ) make up a variable that would normally take a floating point number, a string or an integer. Since all calculations will be performed in floating point and all simple variables require the same amount of memory, the execution was not accelerated by integer variables, but even slowed down, which is why they were rarely used. Arrays can be declared by the DIM instruction; as arrays are integer variables useful because they only occupy 40 % of the memory in this case, which is needed for an equally large floating-point array. Strings puts the interpreter in succession from the memory. Deleted strings are not removed immediately. With lack of memory, an automatic garbage collection (English garbage collection) is started, which could take several minutes for excessive use of strings and the user often suggested a system crash. Later versions (from 4.0 ) Save back pointer to the strings which make unnecessary strings immediately recognizable and let the garbage collection to run in a split second.

The PEEK function and POKE command allow direct reading or direct manipulation of memory; However, due to the different memory structure such use is not compatible between the different models. Especially in the early versions of BASIC 1.0 and 2.0 various system-related functions for which there were no own commands, even via these commands are available. For working with programs in machine language of the SYS command and the USR function becomes available.

Versions ( in chronological order, with each new properties )

  • V1.0: PET 2001 with " Mickey Mouse " keyboard Bug: arrays were limited to 256 elements
  • Oddity: In text mode, the screen shows the shift key works in reverse, unpressed arise uppercase letters, lowercase letters pressed.
  • V2.0: PET 2001 with typewriter keyboard and ROM upgrade, CBM 3000 series, VIC-20, C64 Eliminated most bugs from V1.0
  • Only PET / CBM: Integrated RAM monitor called TIM for display and manipulation of RAM
  • Only PET / CBM: Easter Egg: If you specify WAIT 6502, an x (replace x any number), you will get x - times the word MICROSOFT! on the screen.
  • Keyboard function normalized to Shift towards V1.0
  • V4.0: CBM 4000, 8000 Series, CBM -II ( CBM 500, 6x0, 7x0 ) Floppy commands: DLOAD, DSAVE, COPY, SCRATCH etc, (15 in total)
  • System variables for disk error channel: DS, DS $ ( DS contains the error number, DS $ the error message in plain text)
  • Since this version needed more ROM, another ROM socket ($ Bxxx ) was compared with the PET 2001 fixed assignment, stood ready so that only two free socket for expansion and ROM capacity to 18 KB grew.
  • V3.5: Commodore 264 series ( C16, C116, Plus / 4 ) Sound and graphics commands
  • Joystick query: JOY
  • Hexadecimal conversion: DEC (), HEX $ ()
  • More flexible data - reading: RESTORE [line number]
  • String search: INSTR
  • Formatted Print: PRINT USING, PUDEF
  • Alternative command execution: ELSE
  • Additional loop commands: DO, LOOP, WHILE, UNTIL, EXIT
  • Function key assignment: KEY
  • Additional Editor Commands: AUTO, DELETE, RENUMBER
  • Dynamic error handling: TRAP, RESUME, ERR $ ()
  • Debugging: TRON, TROFF
  • V7.0: C128 Included the expansion of both the version 4.0 and the 3.5.
  • Multiline IF: BEGIN, BEND
  • More sound and graphics commands, and for Sprite control
  • Paddle and light pen - query: POT, PEN
  • Function for Exclusive Or: XOR
  • Determining a variable address: POINTER
  • Text window: WINDOW
  • Pause command: SLEEP
  • Using the two system speeds: SLOW, FAST
  • Switching to C64 mode: GO64
  • Use the extended address space by means of Bank Switching: BANK
  • Using a memory expansion ( REU): STASH, FETCH, SWAP
  • Additional disk commands: BOOT, BLOAD BSAVE, DVERIFY, DClear
  • System commands: RREG ( determines the contents of the CPU registers by a SYS)
  • Defined but unimplemented commands: OFF, QUIT
  • V10: C65 Not completed, many bugs
  • Similar to the Version 7.0
  • Using the genlock function: GENLOCK
  • Mouse commands: MOUSE, RMOUSE
  • Display a SEQ file on the screen: TYPE
  • Find / Replace in source code: FIND / CHANGE
  • Memory management: Advanced FRE function to determine the free space
  • Color definition: PALETTE
  • Command for DMA operations: DMA
  • Defined but unimplemented commands: PAINT, PASTE, CUT, LOCATE, SCALE, WIDTH, QUIT, OFF, SET, VIEWPORT


KIM- 1 • PET CBM 2001 • 3000 • 4000 • CBM CBM 8000 • MMF 9000

CBM 500 CBM * • 600 • 700 • CBM CBM 900 *

VC 10 VC 20 • • C64 (SX, GS †) • 264 series ( C16, C116, Plus / 4) • C128 • C65 *

1000 • sidecar • 500 • 2000 • CDTV † • 600 • 1200 • 4000 • • 3000/T/UX CD ³ ² †

• PC-1 PC - 10 and PC -60 • x86LT • A1060

Datasette • CBM floppy drives • VC15xx ( VC1540/41, VC1551, VC1570/71, VC1581 ) • SFD100x ( SFD1001, SFD1002 ) • CBM 2020-8250 • A570 • A590 • A3070

MPS- MPS Series • 801 • 1000 • MPS MPS 1500C • VC1520 • CBM -8000 Series • CBM 4022

Zorro bus • Watches • Port WOM • RAM Expansion Unit • Commodore mouse • monochrome and color monitors • A10 speakers • Multi-User Systems ( MBS)

Writing and desktop calculators • LED watches 2000K/3000H • † • Chessmate

MOS Technology VIC • • VIC II • TED • VDC • SID • PIA • VIA • TPI • CIA • ACIA • Agnus ( blitter, Copper) • Paula • EHB mode • HAM mode


Commodore BASIC • Commodore Basic V2 • Kernal • CBM ASCII ( PETSCII ) • Commodore GEOS • DOS • AmigaOS • Kickstart • Workbench • ARexxAmigaGuide • AMIX

*: Only prototype †: Console

  • Historic software