Atari BASIC Reference
Guide
145
The previous example consists
of
a
program
that
uses
an
ON
/
GOTO
branch.
At
line
20,
the
ON
/
GOTO
statement
branches
to
line
30
,
40
,
or
50
depending
on
the
valueof
X.
Since X
is
assigned the value 2, the
ON
/
GOTO
statement causes a
branch
to
the second line
numb
er. The second
choice
is
line
40
,
so
the message SECOND
is
printed
.
OPEN
(0.)
The OPEN statement
is
used
to
open
an
input
/
output
channel
for
an
input
or
output
device. The
computer
cannot
receive
input
from
or
send
output
to
a device unless
an
I/ O channel
has
been
opened
for
that
purpose.
CONFIGURATION
OPEN
#a
, b,
c,
"device
[:filespec]"
The first
argument
of
an
OPEN statement
is
the
channel
number.
The channels are
numbered
from
°
through
7.
Channel
number
°
is
always reserved
for
the
editor.
Channel
number
6
is
used
for
graphics, and channel
number
7
is
used
to
save and load
programs. Channel
number
7
is
also used
with
the
LPRINT
statement.
As
a result, channels 1
through
5 are available
for
use
with
BASIC
programs. Channels 6 and 7 are available
only
on
a
limited
basis
for
use
with
BASIC programs. Channel 6
is
available
if
no
graphics are used. Channel 7
is
available unless programs are
being
loaded
or
saved. Also, channel 7
is
unavailable
if
an
LPRI
NT statement
is
executed.
The
second
argum
e
nt
indicates
the
operation
of
the
input
/
output
device. In general, the second
argument
is
4
if
the
computer
is
accepting
information
(input)
.
The
second
argument
is
generally 8
if
the
computer
is
sending
information
(output)
to a device. Table
5-1
contains a
complete
list
of
I/ O
operations
with
their
as
sociated devices and
operation
numbers.