c64-programmers_reference_guide-02-basic_language_vocabulary.pdf

(5747 KB) Pobierz
911984581.002.png
INTRODUCTION
This chapter
explains CBM BASIC Language
keywords.
First we
give
you an easy to read
list of keywords,
their abbreviations
and what
each
letter
looks
like on
the
screen.
Then
we
explain
how
the
syntax
and
operation
of each
keyword
works in detail,
and
examples
are
shown
to
give you an
idea
as
to how to
use them
in your
programs.
As a
convenience,
Commodore
64
BASIC allows
you to
abbreviate
most
keywords.
Abbreviations
are
entered
by typing
enough
letters
of
the keyword
to distinguish
it from
all other
keywords,
with the last letter
the IIIiI key.
or
graphics
entered
holding
down
Abbreviations
do
NOT save
any
memory
when
they're
used
in pro-
grams,
because
all keywords
are
reduced
to single-character
"tokens"
by the
BASIC Interpreter.
When
a
program
containing
abbreviations
is
listed,
all keywords
appear
in their
fully spelled
form.
You can
use ab-
breviations
to
put
more
statements
onto
a
program
line even
if they
won't
fit
onto
the
aO-character
logical
screen
line.
The
Screen
Editor
works on an
aO-character
line. This means
that
if you use abbreviations
on any
line that
goes
over
ao characters,
you will NOT be
able
to edit
that
line when
LISTed. Instead,
what
you'll have
to do
is (1) retype
the
entire
line including all abbreviations,
or (2) break
the single line of code
into two
lines,
each
with
its own
line number,
etc.
A complete
list of keywords,
abbreviations,
and
their
appearance
on
the
screen
is presented
in Table
2-1.
They are
followed
by an
alpha-
betical
description
of
all
the
statements,
commands,
and
functions
available
on your
Commodore
64.
This chapter
also
explains
the
BASIC functions
built
into the
BASIC
Language
Interpreter.
Built-in functions
can
be
used
in direct
mode
statements
or
in any
program,
without
having
to
define
the
function
further.
This is NOT the case
with user-defined
functions.
The results
of
built-in BASIC functions
can
be used
as immediate
output
or they can be
assigned
to
a
variable
name
of
an
appropriate
type.
There
are
two
types
of BASIC functions:
1) NUMERIC
2)
STRING
Arguments
of
built-in
functions
are
always
enclosed
in parentheses
().
The
parentheses
always
come
directly
after
the
function
keyword
and
NO SPACES between
the
last
letter
of the
keyword
and
the
left
parenthesis
(.
30
BASIC LANGUAGE VOCABULARY
911984581.003.png
The type of argument
needed
is generally
decided
by the data
type in
the
result.
Functions which
return
a string
value
as their
result are
iden-
tified
by having
a dollar
sign ($) as the last character
of the keyword.
In
some
cases
string
functions
contain
one
or more
numeric
argument.
Numeric
functions
will
convert
between
integer
and
floating-point
format
as
needed.
In the
descriptions
that
follow,
the
data
type
of the
value
returned
is shown
with
each
function
name.
The types
of argu-
ments
are
also
given
with the
statement
format.
Table 2-1. COMMODORE64 BASICKEYWORDS
COMMAND
ABBREVIATION
SCREEN
FUNCTION TYPE
Am
NUMERIC
ABS
A IDIIiI B
AND
A BIIiI N
AIZJ
A
NUMERIC
ASC
A EIIIiI S
NUMERIC
ATN
AD
ABIIiI T
CHR$
. STRING
C []
C IDIIiI H
CL 0
CLOSE
CL EIIIiI 0
C 0
CLR
C BIIiI L
CMD
C lSI
CEIIIiIM
C 0
CONT
c.BII 0
COS
none
NUMERIC
COS
DATA
D IDIIiI A
D I!I
D_
E
D EJ
DEF
DIM
D_
I
D f;J
BASIC LANGUAGE VOCABULARY
31
911984581.004.png
COMMAND
SCREEN
ABBREVIATION
FUNCTION TYPE
0
END
E
E IDID
N
EXP
E Emil
x
E
NUMERIC
FN
FN
none
0
F BIIiI 0
F
'FOR
Q
FRE
R
F
NUMERIC
F ,BIIiI
EJ
GET
E
G,EDIIII
G
GET#
none
GET#
GOSUB
S
GO
BIIiI
GO
GOTO
G ,BIIiI
GO
0
IF
IF
none
none
INPUT
INPUT
0
I
INPUT#
I 'BIIiI
N
none
INT
NUMERIC
INT
g
STRING
F
lEFT$
LE IDID
LE
NUMERIC
none
LEN
LEN
D
L
LET
E
L EIDIiI
LIST
I
L
L EIDIiI
0
L
LOAD
L BID
0
LOG
'none
LOG
NUMERIC
'32
BASIC LANGUAGE VOCABULARY
911984581.005.png
COMMAND
SCREEN
ABBREVIATION
FUNCTION TYPE
M IIID
MID$
STRING
M EJ
I
NEW
none
NEW
N IIID E
NEXT
N EI
N 0
N BIID 0
NOT
ON
none
ON
o BIID P
OPEN
00
OR
none
OR
PEEK
NUMERIC
P IIID E
pEJ
POKE
P 0
P BIID 0
POS
none
POS
NUMERIC
PRINT
?
?
PRINT#
P
P IIID R
bJ
READ
R
R IIID E
E]
REM
none
REM
RE
RESTORE
REIIID S
RETURN
RE [[]
REBIID T
S RING
RIGHT$
R
R BIID
I
R 0
NUMERIC
RND
R BIID N
RUN
R CLI
REmlU
33
BASICLANGUAGE VOCABULARY
911984581.001.png
Zgłoś jeśli naruszono regulamin