EXAMPLES: A(7).BZ%<1
1),AS(87)
Arrays
may have mote lhan one
dimension. A two dimensional array
may
be
viewed
as having rows and
columns, with the first number
Identltylng the column
and the second number in
the parentheses
Identifying the row
{as
it specifying
a certain grid on
a map)
EXAMPLES:
A(7.2) BZ%(2.3,4)7S<3.2)
RESERVED
VARIABLE NAMES
There are seven variable
names which are reserved for
use by the
Commodore
'6. and may not
be used
for
another purpose.
These are
the variables
DS, DSS. ER,
EL.
ST.TI,
and
TIS.
You also can'i
use
KEYWORDS such
as TO and
IF,
or any names that contain
KEYWORDS,
such
as
SRUN.
RNEW, or XLOAD
as
variable names.
ST
is
a
status
variable lor
Input and
output (except
normal
screen/
keyboard
operations).
The value of ST depends on the results of
the
last input/output
operation. A
more
detailed
explanation of ST is In
the
Series
264
Programmer's
Reference Guide,
bul in general, if the value
of ST is the operation
was sucessful
Tl and
Tis are variables
that
relate
to the real-time clock built
Into your
Commodore 1
6
The system
clock <s updated every I /60th of
a
secooa It
starts at when your
Commodore 1 6 Is turned on and is
reset only
by
changing
(he value
of
Tl$.
The variable Tl gives you the
current value of the clock in 1
/6Qlhs of
a second.
TIS is
a
string that
reads the value
of the real-time clock as
a
24 hour
clock The first two characters
of TIS contain the
hour, the 3rd and 4th
characters are the minutes,
and the
5th
and
6th
characters
are the
seconds. This variable can
be set to any value
(so
long
as all characters
are numbers),
and
will
be automatically
updated as a
24
hour
clock
EXAMPLE:
TIS
= "101530"
sets the dock to 10 1
5
and
30 seconds
(AM)
The
value of the clock is
lost wnen your Commodore 16
is
turned
off
It
slarts at zero when
your computer is turned on,
and
is reset
to zero
when the
value
of
the
clock exceeds 235959
(23
hours. 59 minutes
and
59 seconds).
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
!
(
I
f
1
1
(
I
I
1
!<
1 1
I
'
1 1
I
1
1
f
The variable DS reads the disk drive command channel, and returns the
current
status of the
drive. To
gel
this Information
In words. PRINT
DSS. These status
variables are
used
after
a
disk operation,
like a
DLOAD or DSAVE.
to
find out why the
red
error light on the disk drive
is blinking.
ER, EL. and ERRS are variables used in error trapping routines. They
are usually
only
useful within a program ER returns the
last
error
encountered since
the
program
was RUN. EL is the
line
where
the error
occured. ERRS is
a
function which allows your program
to
prinl one of
the BASIC error messages. PRINT ERRS(ER)
prints
out the proper error
message.
BASIC OPERATORS
Tne ARITHMETIC operators include the following signs
+ addition
-
subtraction
*
muImplication
/ division
T
raising to a power (exponentiation)
On a
line containing
more
lhan
one operator,
there is
a set order in
which operations
always
occur. If several operators are used together,
the computer
assigns priorities
as
follows; First, exponentiation. Ihen
multiplication and division,
and last,
addition and subtraction If two
operations have
the
same priority, then calculations are performed in
order from left
to
right. If
you
want Ihese operations to occur In
a
different order, Commodore 16 BASIC allows you to give a
calculation
a
higher priority
by
placing parentheses
around it.
Operations enclosed
in
parentheses will
be
calculated before any other operation. You have
to make sure that your equations have the same
number
of left
parentheses
as
right parentheses, or
you
will
gel a
SYNTAX
ERROR
message when your program is njn.
There are also
operators
for equalities and inequalities, called
RELATIONAL operators Arithmetic operators always take priority over
relational
operators.
is equal to
< is
less
than
>
is
greater
than
<=
or
<
=
<
Is less than
or
equal
to
155