Commodore 16 User Manual page 79

Hide thumbs Also See for Commodore 16:
Table of Contents

Advertisement

EXAMPLES: A(7),BZ %(11).A$(87)
Arrays may have more than one dimension. A two dimensional array
may be viewed as having rows and columns, with the first number
identifying the column and the second number in the parentheses
Identifying the row (as if specifying a certain grid on a map).
EXAMPLES: A(7,2)13Z % (2.3,4). Z$(3.2)
RESERVED VARIABLE NAMES
There are seven variable names which are reserved for use by the
Commodore 16. and may not be used for another purpose. These are
the variables DS, Mt ER. EL, ST,TI, and Ti$. You also can't use
KEYWORDS such as TO and IF, or any names that contain
KEYWORDS. such as SRUN. KNEW. or XLOAD as variable names.
ST is a status variable for 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 Programmers Reference Guide. but in general, if the value
of ST is 0 the operation was sucessful
TI and 715 are variables that relate to the real-time clock built into your
Commodore 16 The system clock is updated every 1/60th of a
secono. It starts at 0 when your Commodore 16 is turned on. and is
reset only by changing the value of 71$. The variable TI gives you the
current value of the clock in 1 /60ths of a second.
71$ is a string that reads the value of the real-time clock as a 24 hour
clock. The first two characters of 71$ 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: TI$ = "101530" sets the clock to 10.15 and 30 seconds
(AM)
The variable DS reads the disk drive command channel, and returns the
current status of the drive. To get this information in words, PRINT
DS$. 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 ERR$ 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 print one of
the BASIC error messages. PRINT ERR$(ER) prints out the proper error
message.
BASIC OPERATORS
Tne ARITHMETIC operators include the following signs.
addition
subtraction
multiplication
division
raising to a power (exponentiation)
On a line containing more than 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. then
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 these 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 get a SYNTAX ERROR
message when your program is run
There are also operators for equalities and Inequalities. called
RELATIONAL operators. Arithmetic operators always take priority over
relational operators.
The value of the dock is lost wnen your Commodore 16 is turned off It
starts 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).
Is equal to
is less than
is greater than
< = Or = < is less than or equal to
154
155

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Commodore 16 and is the answer not in the manual?

Questions and answers

Table of Contents