SIMPLE VARIABLES
COMMODORE 64 QUICK REFERENCE CARD
Type Nam~ Range
Real XY ::1.701411183E+38
~2.93873S88E-39
Integ~r XY" ~32767
String XY$ 0 to 255 charaCters
X is a tener (A-Z), Y is a Jener ar number (0.9). Variable names
can be more than 2 choracters. but only the firsl two are recog.
niud.
ARRAY "'RIAlLES
Type
Singl~ Dimension
Two-Dimension
Three-Dimension
Name
XY(S)
XY(5,S)
XY(S,5,S)
AlGEBRAIC OPERATORS
Arrays of up 10 eleven .Iements (subscripts 0.10) can be used
where n.ed~d. Anay$ with more Ihan eleven er~m.nts need 10
be DIMens;on.d.
= Assigns ...alu. 10 variabl.
- "'egalion
Exponentiation
· Multiplication
I Division
+ Addition
- Sublraction
RELATIONAL AND LOGiCAl OPERATORS
Equal
<> NOl Equal 10
< LessThan
> Greol~r Than
< = Less Thon or Equal To
> = Grealer Thon or Equal To
NOT logical "Nor"
AND logical "And"
OR logical "Or"
Expr.ssion..quals 1 if true, 0 if fals~.
SYSTEM COMMANDS
LOAD
"NAME"
SAlE "NAM£'"
LOAD "NAME" ,8
SAlE "NAME" ,8
. VERIFY "NAME"
RUN
RUNxxx
STOP
END
CONT
PEEK(X)
POKE X,Y
SYS xxxxx
WAIT X. Y.Z
USR(X)
loads a program from tope
Sav.s a program on lope
loads a program from disk
Sa s a program 10 disk
Verifies Ihal program was SAlEd
wilhoul ~rrors
Execules a program
Execules program storting at line
"""
Holts execution
Ends execution
Continues program execution from
lin. where program was halted
R.lums conlents of memory
location X
Chang.s contenls of 10cOlion X
10 ...alue Y
Jumps to .xecule a machine language
program, starting at JCXXXX
Program wafts until conlents of'
location X, when FORed with Z and
ANDed with Y, is nonzero.
Posses value of X 10 a machine
language subrouline
EDITING AND FORMAJTlNG COMMANDS
LIST
USTA-.B
REMMessage
tAB(X)
Lisn entire program
Usts from line A to line B
Comment message can be listed but
is ignored during program execution
Used In PRINT stotements. Spaces X
pasltions on screen
SPC(X)
POS(X)
ClR/HOME
PRINTs X blanks on line
Relurns currenl cursor position
Posilions cursor to left comer of
scr~~n
CI.ars scr.en and places cursor in
"Home" position
Inserts spac. at current cursor
position
Deletes character at currenl cursor
position
When us.d wilh numeric color key,
sel.cts text color. May b~ used in
PRINT slatement.
Moves cursor up, down. left, righl
SHIFT CLRlHOME
SHIFT INST/DEL
INST/DEL
CTRL
CRSR Keys
Commodore Key
When used with SHin s.lects
betw..n upperllower case and
graphic display mod..
When us.d wilh numeric color key,
selects oplional lext color
ARRAYS AND STRINGS
DIM A(X. Y.Z)
Sets maximum subscripts for A;
reserves space for (X+1)-(Y+1)-CZ+1)
eJem.nts starting 01 A(O,O,O)
Returns number of characters in X$
Re",rns numeric value of X.
con rt.d 10 a string
Returns num.ric value of AS, up 10
first nonnumeric character
Returns ASCII character whose code
is X
Returns ASCII cod. for fir"
character of XS
Retums leftmost X characlers of AS
Relurns rightmost X characters
of AS
Relurns Y characters of AS
Slorting at character X
LEN(XS)
STRS(X)
UX$)
CHRS(X)
ASC(X$)
LEFT$(AS.X)
RIGHTS(A$,X)
MIDS(AS,X, Y)
INPUT/OUTPUTCOMMANDS
INPUTAS OR A PRINTs'?' on screen and waits for
us.r to enter a sIring or value
INPUT"ABC";A PRINTsmessage and waits for user
to ent.r value. Can also INPUTAS
GETA$ or A 't'Ibits for user 10type one-
character value; no RETURNneed.d
DATAA,"B",C Initializes a s.t of values thol
can be used by READstatement
READA$ or A Assigns nexl DATAvalue 10AS or A
RESTORE Res~Is dOlo pointer to start
READingthe DATAlist again
PRINT"A-";A PRINTsSIring 'A= ' and value of A
./ suppresses spac.s -': tabs data
to next field.
PROGRAM ROW
GOTO X Branche. 10 line X
If A=3 THEN 10 If assertion is Irue THENexecute
following port of statement. If
fal... execute next line number
FOR A= 1 TO 10 Executes all statements betw.en FOR
STEP2 : NEXT and corresponding NEXT.with A
going from 1 10 10 by 2. SI.p size
is 1 unless s~jfied
NEXTA Defines .nd of loop. A is optional
GOSUB 2000 Branches 10 subroutine slarting at
line 2000
RETURN Marks end of subroutine. R~turns to
stat.ment following mosl recent
GOSUB
ON X GOTO A,B Bronches 10 xth line number on
list. If X-I branches 10 A, elc.
ON X GOSUBA,B Bronches 10 subroutine at Xth line
number in list