C64 SCREEN

Joystick: (Arrow keys + Space = Fire)

Click the screen and type. Esc is RUN/STOP, Home is CLR/HOME, Alt is the C= key. Paste a listing with Ctrl+V, or drop a .prg or .crt file onto the screen.

BASIC PROGRAM

Commodore 64 BASIC Quick Start

The Commodore 64 uses BASIC (Beginner's All-purpose Symbolic Instruction Code). You can interact in two ways:

The editor's Run loads numbered programs on a freshly reset C64. The screen's RUN repeats the loaded program without resetting. Direct-mode examples keep the current machine state.

System Commands

NEWErases program from memory.
RUNExecutes the current program.
LISTDisplays program lines on screen.

Variables

Only the first two characters of a variable name are significant.

  • Floats: A = 5.5
  • Integers: A% = 10
  • Strings: A$ = "HELLO"

Input & Output

  • PRINT — Output to screen
    10 PRINT "HELLO"
  • INPUT — Get user input
    20 INPUT "NAME"; N$
  • GET — Read single keypress
    30 GET K$

Program Flow

  • GOTO — Jump to a line
    50 GOTO 10
  • GOSUB / RETURN — Call subroutine
    60 GOSUB 200
  • IF...THEN — Conditional
    40 IF A > 10 THEN PRINT "BIG"

Loops

  • FOR...NEXT — Counted loop
    10 FOR I = 1 TO 5
    20 PRINT I
    30 NEXT I

Graphics & Sound

  • POKE — Write to memory
    POKE 53280, 0 (border black)
  • PEEK — Read from memory
    X = PEEK(53280) (254 after start-up: the unused top four bits read as 1)

Not sure which address to POKE? Point at the screen: the inspector under it shows the screen and colour memory behind every character, and the sprite X/Y of any spot.

Colour & Control Codes

Printed listings write the C64's special keys inside quotes as names in braces. The editor understands them:

10 PRINT "{CLR}{YEL}HELLO {RVS ON}THERE"
  • {CLR} clear screen, {HOME} cursor home
  • {RED} {GRN} {BLU} {YEL} {WHT} {BLK} … colours
  • {RVS ON} / {RVS OFF} reverse text
  • {DOWN} {UP} {LEFT} {RIGHT}, repeated as {3 DOWN}
  • {147} any code by number

Your Keyboard as a C64

EscRUN/STOP
HomeCLR/HOME (with Shift: clear screen)
BackspaceINST/DEL
AltC= (Commodore key)
CtrlCTRL
F1–F8Function keys

The editor works like the C64's own: lines are kept in number order, typing a line number again replaces that line, and a number on its own deletes it.