122 User's
Handbook
to
the
Atari
400/ 800
Computers
The previous example consists
of
a
program
that
uses
GET
with
the
display. Line
10
opens 1/ 0 channel
#3
for
input
from
the
display (device "5"). Line
20
specifies graphics
mode
2.
Line
30
indicates the character and
color
that
is
displayed. Table 9-4 lists
the
COLOR
codes
for
graphi
cs
mode
2.
COLOR
65
indicates
an
upper
case
A in
color
register
O.
Sin
ce
SETCOLOR is
not
used in
this program,
the
character
is
orange,
the
default
color. The
PLOT stateme
nt
at
line
40
places the character at the
upper
left
corner
of
the display. Line
50
moves
the
cursor
to
the
same
position
as
the character (0,0). The
GET
statement at
line
60
assigns the
COLOR
information
to
the variable
X.
The channel
number
in
the
GET
statement must be the same
as
the channel
number
in the OPEN statement. Line
70
displays the
COLOR
information
(65)
on the display, and line
80
closes
the
1/ 0
channel.
GET
can also be used with the screen ed
itor
(device "E"). The
OPEN statement must
includ
e
an
unused
1/0
channel
number.
Also, the OPEN statement must have
operation
code
4
(input)
or
12
(input
and
output)
. Sin
ce
the screen ed
it
or
uses
the keyboard
for
input,
the
GET
statement h
as
nearly the same
function
with
devices
"K"
and
'T'.
The
GET
statement assigns
the
ASCII code
of
a keystroke
to
the variable specified in the statement. The
program
waits
for
input
from
the keyboard
before
it
contin
u
es.
However
,
when
a
GET
statement
is
executed, the character
from
the keyboard must be
followed
by RETURN.
EXAMPLE
10
OPEN
#3,
4,
0,
"E"
20
GET
#3,
X
30
PRINT X
40
CLOSE
#3
RUN
(press
"5"
followed
by RETURN)
83
In the previous example, line
10
opens channel
#3
for
input
from
the screen ed itor. When the screen ed
itor
is
accessed, the screen
is
cleared. The program wi ll wait
at
line
20
for
input
from
the
keyboard.
If
more
than
one
character
is
entered
,
an
error
results.