Commodore 64 User Manual page 179

Hide thumbs Also See for 64:
Table of Contents

Advertisement

COMMODORE 64 QUICK REFERENCE CARD
SIMPLE VARIABLES
Type
Name Range
Real XV 21.70141183E+38
22.93873588E-39
Integer XY% 232767
String XYS 0 to 255 characters
X is a letter IA-Z), Y is a letter or number (0-9). Variable names
can be more than 2 characters, but only the first two are recog-
zed.
ARRAY WRIABLES
Type
Name
Single Dimension XY(5)
>wo-Dimension
XY(5,5)
Three - Dimension
XY(5,5,5)
Arrays of up to eleven elements (subscripts 0-10) can be used
where needed. Arrays with more than eleven elements need to
be DIMensioned.
ALGEBRAIC OPERATORS
Assigns value to variable
- Negation
T Multiplication
on
Divi . n
Addition
Subtract,,
RELATIONAL AND LOGICAL OPERATORS
Equal
C> Not Equal To
C Less Than
> Greater Than
<= Less Than or Equal To
>= Greater Than or Equal To
NOT Logical "Not"
AND Logical "And"
OR Logical "Or"
Expression equals I if true , 0 if false.
SYSTEM COMMANDS
LOAD "NAME"
Loads a program from tape
SAVE "NAME"
Saves a program on tape
LOAD "NAME", 8 Loads a program from disk
SAVE "NAME", 8 Saves a program to disk
VERIFY "NAME"
Verhes that program was SAVEd
without errors
RUN Executes a program
RUN xxx Executes program starting at line
STOP Halts execution
END Ends execution
CONT Continues program execution from
line where program was halted
PEEK ( X) Returns contents of memory
location X
POKE X,V Changes contents of location X
to value V
SYS xxxxx Jumps to execute a machine language
program , starting at xxxxx
WAIT X,Y,Z Program waits until contents of
location X , when EORed with Z and
ANDed with Y, is ,zero.
USR(X)
Passes value of X to a machine
language subroutine
EDITING AND FORMATTING COMMANDS
LIST Lists entire program
LIST A-B Lists from line A to line 8
REM Message
Comment message an be listed but
is ignored during program cation
TAB(X) Used in PRINT statements . Spaces X
positions on screen
SPC(X)
PRINTs X blanks an line
POS(X)
Returns current -co, position
CLR/HOME Positions cursor to left corner of
SHIFT CLRIHOME
Clears screen and places cursor in
"Home " Position
SHIFT INST/DEL Inserts space at current cursor
position
INST/DEL Deletes character at current cursor
CTRL
When used with n umeric color key,
Pos it ion
selects text color. May be used in
PRINT statement.
CRSR Keys Moves cursor up, down, left, right
Commodore Key
Whenr used with SHIFT selects
between upper/ lower case and
graphic display mode.
When used with nu mer i c color key,
selects optional text color
ARRAYS AND STRINGS
DIM AIX , Y, Z) Sets m-mu m subscripts far A;
rese rves space far '(Z+ 1)
elements starting at A(0,0,0)
LEN XS )
Returns number of characters in X$
STRS ( X) Returns numeric value of X,
averted to a string
VAL(XS )
Returns num e ri c value of AS, up to
firs n r. character
CHRS(X )
Return, ASCII character whose code
is X
ASC(XS) Returns ASCII code far first
character of XS
LEFT$ (A$,X) Returns leftmost X characters of AS
RIGHTS ( AE,X) Returns rightmost X characters
of AS
MIDS(AS , X,V) Returns V characters of AS
starting at character X
INPUT/ OUTPUT COMMANDS
INPUT AS OR A PRINTs '?' on screen and w , it, for
r enter a string or value
INPUT "ABC";A
PRINTS m sage and w its for user
to enter value Can also INPUT AS
GET AS or A V*cts for us r to type one-
character value; no RETURN needed
DATA A," B",C Initializes a set of values thbr
ca n be used by READ statement
READ A$ or A Assigns next DATA value to AS or A
RESTORE Resets data pointer to start
READing the DATA list again
PRINT " A= ";A PRINTs string ' A= ' and value of A
suppresses spaces - ,' tabs data
to next field.
PROGRAM FLOW
GOTO X Branches to line X
IF A=3 THEN 10 IF assertion is true THEN execute
following port of statement. IF
false ,
x cure next line n u mber
FOR A= 1 TO 10 Executes all statements between FOR
STEP 2 : NEXT and cor responding NEXT, with A
going from I to 10 by 2. Step size
is I unless specified
NEXT A Defines end of loop . A is optional
GOSUB 2000
Branches to subroutine starting at
line 2000
RETURN Marks and of subroutine . Returns to
statement following most recent
GOSUB
ON X GOTO A, B Branches to Xth line number on
list. If X = I branches to A, etc.
ON X GOSUS A,B Branches to subroutine at Xth line
number in list

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Commodore 64

Table of Contents