EasyManuals Logo

Atari 800 Basic Reference Manual

Atari 800
122 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #50 background imageLoading...
Page #50 background image
42
Array
s
and
Matrices
A DIM
statement
is
used
to
reserve
a
certain
number
oflocations
in
memory
for
a
string,
array,
or
matrix.
A
character
in
a
string
takes
one
byte
in
memory
and
a
number
in
an
array
takes
six
bytes.
The
first
example
reserves
101 locations
for
an
array
designated
A.
The
second
example
reserves
7
rows
by
4
columns
for
a
two-dimensional
array
(matrix)
designated
M.
The
third
example
reserves
20
bytes
designated
B$.
All
strings,
arrays,
and
matrices
must
be
dimen-
sioned.
It
is a
good
habit
to
put
all DIM
statements
at
the
beginning
of
the
pro-
gram.
Notice
in
Figure
8-1
that
although
the
array
is
dimensioned
as DIM A(6),
there
are
actually
7
elements
in
the
array
because
of
the
0
element.
Although
Figure
8-2
is
dimensioned
as
DIM M(6,3), 28
locations
are
reserved.
Note:
The
ATARI
Personal
Computer
does
not
automatically
initialize
array
or
matrix
variables
to
0
at
the
start
of
program
execution.
To
initialize
array
or
matrix
elements
to
0,
use
the
following
program
steps:
250
orr·1
A(
100
>
300
FOR
E==0
TO
ll1l1
310
A(3
>=0
32f1
t·E·<T
E
Arrays
and
matrices
are
"filled"
with
data
by
using
FOR/NEXT
statements,
READIDA T A
statements
and
INPUT
commands.
Figure
8-3
illustrates
the
"building"
of
part
of
an
array
using
the
FOR/NEXT
loop
and
Figure
8-4
builds
an
array
using
the
READ/DATA
statements.
10
DH1
A<
we>
2f1
::·::=
1
(1
3(1
FO~:
E=1
TO
9(1
40
::-::=:~
=:+
1
50
A(E
)=>=:
60
t·
4E>::T
E
70
FOP
E=1
TO
90
B(l
PF.:H-JT
E..
A(
E >
90
t
·
~E::-=:T
E
Figure
8-3.
Use
of
FOR/NEXT
to
Build
An
Array
10
DH1
A(3)
20
FOR
E=l
TO
3
30
F.:EAD
>=:
40
A(E>=>=:
50
PRHiT
A<E
).,
60
t·~E::-
=
:T
E
70
am
10(1
DATA
33
..
45
.,
12
Figure
8-4.
Use
of
R.EAD
/
DATA
to
Build
An
Array

Table of Contents

Other manuals for Atari 800

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari 800 and is the answer not in the manual?

Atari 800 Specifications

General IconGeneral
ProcessorMOS Technology 6502
Processor Speed1.79 MHz
ROM10 KB
GraphicsANTIC and GTIA chips
Release Year1979
Display Resolutionup to 320 x 192
Colors128 colors
Sound4 channels
StorageCartridge, cassette, floppy disk
PortsCartridge, serial, monitor
Operating SystemAtari OS

Related product manuals