Atari BASIC
Reference
Guide
121
The
previous
exa
mple
cons
ists
of
a
program
that
uses
the
GET
statement
with
the
keyboard
. Line
10
opens channel
;;2
for
the
keyboard
input.
In line
20
, the
GET
statement assigns the ASCII
code
of
a character
to
the variable
X.
Line
30
displays the ASCII
code on
the
sc
reen.
When
the
program
is
executed,
line
10
opens
the
I/ O c
hannel
,
but
the
pro
gram waits
at
line
20.
When
the next keystroke occurs, the
program
continues
. In this
example, the keystroke
is
the S key.
Th
e ASCII
code
of
Sis
83,
so
X
is
assigned
the
value
83.
Line
30
causes
83
to
be
printed
on
the
display, and
line
40
closes the I/ O channel.
The
GET
statement can al
so
be used
with
the display.
An
OPEN
s
tatement
mu
st
precede
the
GET
state
ment.
The OPEN
statement specifies
an
I/ O channel that is
not
currently
open.
The
channel
number
must be
from
1
to
7.
Th
e second a
rgument
mu
st be 4
(input)
or
12
(inp
ut and
output)
, and
the
device
must
be
"5".
With
the display, the
position
of
the
cursor
determines
the character
or
picture
e
lement
to
whi
ch
the
GET
statement
applies. The
GET
statement retrieves
the
COLOR
information
at
that
point.
In graphics modes 0, 1, and 2,
the
COLOR
information
indicates
a character (and
color
register). Tables 9-4 and 9-7 list
the
COLOR
values
for
graphics modes 0, 1, and
2.
In graphics modes
3
through
8,
the
GET
statement indicates the
color
of
the
picture
element
where
the
cursor
is
located. The value
that
a
GET
statement retrieves
is
assigned
to
the
variable in
the
GET
statement. The cursor advances
to
the
ne
xt
position
after
a
GET
statement
has
been
executed
. An
attempt
to
execute
a
GET
statement
when
the
cursor
is
at the last
column
of
the
last
row
results in an
error.
EXAMPLE
10
OPEN
#3,4,0,
"5"
20
GRAPHICS 2
30
COLOR
65
40
PLOT 0,0
50
POSITION 0,0
60
GET
#
3,
X
70
PRINT X
80
CLOSE
#3