BASIC & disk commands

The commands you'll type every day, then every Commodore 64 BASIC V2 keyword with its typing shortcut.

Print the full guide

Nothing on this page matches. Clear the filter or try another page from the menu.

Disk and file commands

Type at the READY prompt and press RETURN. Drive A is unit 8, Drive B is unit 9.

Command What it does
LOAD"$",8 then LIST Show the disk's file list (wipes the program in memory!)
LOAD"*",8,1 then RUN Load and start the first program (how most games start)
LOAD"NAME",8 Load a program by name
SAVE"NAME",8 Save your program
SAVE"@:NAME",8 Save and replace an existing file
VERIFY"NAME",8 Check a save matches memory
LOAD (alone) Load from tape ("PRESS PLAY ON TAPE")
OPEN15,8,15,"S:NAME":CLOSE15 Delete (scratch) a file on disk
OPEN15,8,15,"R:NEW=OLD":CLOSE15 Rename a file on disk

Everyday program commands

Command What it does
NEW Erase the program in memory
LIST / LIST 10-50 Show program lines (hold CTRL to slow, RUN/STOP to stop)
RUN Start the program
CONT Continue after STOP or RUN/STOP
PRINT "HI" or ? "HI" Print text or a calculation (?2+2)
INPUT A$ / GET A$ Read typed text / a single key
IF X=1 THEN 100 Make a decision
FOR I=1 TO 10 ... NEXT Loop
GOTO 100 / GOSUB 500 ... RETURN Jump / call a subroutine
POKE 53280,0 Write memory (this one: black border)
PEEK(53280) Read memory
SYS 64738 Jump to machine code (this one: soft reset)
RND(1), INT(X) Random number, whole number
CHR$(147) Clear screen inside PRINT

Every BASIC keyword

Shortcut = type the letters shown, holding SHIFT for the last one (L then SHIFT+O = LOAD). A dash means there's no shortcut. Shortcuts expand to the full keyword, and a program line holds at most 79 characters.

Programs and files

Keyword Shortcut What it does
LOAD L SHIFT+O Load a program (LOAD"NAME",8)
SAVE S SHIFT+A Save a program (SAVE"NAME",8)
VERIFY V SHIFT+E Check a save
LIST L SHIFT+I Show program lines
RUN R SHIFT+U Start the program
NEW – Erase program from memory
CONT C SHIFT+O Continue after a stop
STOP S SHIFT+T Stop the program here
END E SHIFT+N End the program
CLR C SHIFT+L Clear all variables
OPEN O SHIFT+P Open a file or device (OPEN1,8,2,"DATA,S,W")
CLOSE CL SHIFT+O Close a file
PRINT# P SHIFT+R Write to a file/printer
INPUT# I SHIFT+N Read a line from a file
GET# – Read one character from a file
CMD C SHIFT+M Send screen output to a file/printer

Program flow

Keyword Shortcut What it does
GOTO G SHIFT+O Jump to a line
GOSUB GO SHIFT+S Call a subroutine
RETURN RE SHIFT+T Return from subroutine
ON – ON X GOTO 100,200 choose a jump by number
IF / THEN – / T SHIFT+H Decision
FOR / TO / STEP F SHIFT+O / – / ST SHIFT+E Start a loop
NEXT N SHIFT+E End of loop
REM – Comment (ignored)
WAIT W SHIFT+A Pause until a memory value changes
SYS S SHIFT+Y Run machine code at an address
USR U SHIFT+S Call a machine-code function

Data and variables

Keyword Shortcut What it does
LET L SHIFT+E Assign (optional: A=5 works)
DIM D SHIFT+I Make an array (DIM A(20))
DATA D SHIFT+A Store values in the program
READ R SHIFT+E Read the next DATA value
RESTORE RE SHIFT+S Start DATA from the beginning again
DEF FN D SHIFT+E Define your own function
INPUT – Ask the user to type something
GET G SHIFT+E Read one key (no waiting)
PRINT ? Show text and numbers
POKE P SHIFT+O Write a byte to memory
PEEK P SHIFT+E Read a byte from memory

Number functions

Keyword Shortcut What it gives
ABS A SHIFT+B Absolute value
INT – Whole number (rounds down)
RND R SHIFT+N Random number 0–1 (INT(RND(1)*6)+1 = dice)
SGN S SHIFT+G Sign: −1, 0 or 1
SQR S SHIFT+Q Square root
EXP / LOG E SHIFT+X / – e to the power / natural log
SIN / COS / TAN / ATN S SHIFT+I / – / – / A SHIFT+T Trigonometry (radians)
FRE F SHIFT+R Free memory (?FRE(0))
POS – Cursor column

Text (string) functions

Keyword Shortcut What it gives
LEN – Length of text
LEFT$ LE SHIFT+F Leftmost characters
RIGHT$ R SHIFT+I Rightmost characters
MID$ M SHIFT+I Characters from the middle
STR$ ST SHIFT+R Number → text
VAL V SHIFT+A Text → number
ASC A SHIFT+S Character → code
CHR$ C SHIFT+H Code → character (CHR$(147) clears screen)
TAB( T SHIFT+A Move to column in PRINT
SPC( S SHIFT+P Print spaces

Logic and special variables

Keyword What it is
AND / OR / NOT Logic (also bit operations)
ST Status of last input/output (0 = OK, 64 = end of file)
TI Clock ticks since power-on (60 per second)
TI$ Clock as "HHMMSS"; set it with TI$="120000"

Handy POKEs and SYS

Type Effect
POKE 53280,X Border color (0–15)
POKE 53281,X Background color
POKE 646,X Text color
POKE 650,128 All keys repeat
SYS 64738 Soft reset

Color numbers are on the Programming page.