•
channels
A channel
is
a means by which data can
be
output
to
or
Input from a QL device. Before
a channel can be used
it
must
first
be activated
(or
opened)
with
the OPEN command.
Certain channels should
always
be kept open: these are the default channels and allow
simple communication with the QL via the keyboard and screen. When a channel
is
no longer
In
use
it
can
be
deactivated (closed)
with
the CLOSE command.
A channel
is
identified by a channel number. A channel number
IS
a numeric expression
preceded by a
#.
When the channel
is
opened a device
is
linked
to
a channel number
and the channel
is
initialised. Thereafter the channel
is
identified only by
its
channel
number
For
example:
OPEN
#5,SER1
Will
link
serial
port 1
to
the channel number
5.
When a channel
is
closed only the channel
number need
be
specified.
For
example:
CLOSE
#5
Opening a channel requires that the device driver for that channel
be
activated. Usually
there
is
more than one
way
in
which the device driver can be activacted, for example
the network requires a
station number. This extra information
IS
appended
to
the device
name and passed
to
the OPEN command
as
a parameter see concept device and
peripheral expansion.
Data can be output
to
a channel by PRINTing
to
that channel; this
is
the same
mechanism by which output appears on the QL screen. PRINT without a parameter •
outputs
to
the default channel #
1.
For
example
10
OPEN
#5,
mdv1
test
file
20
PRINT
#5,
"this
text
is
in
fi
Le
test
fi
le"
30
CLOSE
#5
will
output the text
1his
text
is
In
file
test_file'
to
lhe
file
tesLfile.
It
IS
important
to
close
the
file
after
all
the accesses
have
been completed
to
ensure that
all
the data
is
written.
Data can
be
input from a file
In
an
analogous
way
uSing
INPUT. Data can be input
from a channel a character
at
a time
uSing
INKEY$.
A channel can be opened
as
a console channel; output
is
directed
to
a specified window
on the OL screen and input
is
taken from the QL keyboard. When a console channel
is
opened the
size
and shape
of
the initial window
is
specified.
If
more than one console
channel
is
active then
it
is
possible for more than one channel
to
be requesting input
at
the same
time.
In
this
case,
the reqUired channel can be selected by pressing
CTRL
C
to
cycle round the waiting channels.
The
cursor
in
the window
of
the selected channel
will
flash.
The OL has three default channels which
are
opened automatically. Each
of
these
channels
is
linked
to
a window on the QL screen:
channel 0 - command and error channel
channel 1 - output and graphics channel
channel 2 - program listing channel
•
4
Monitor
Command
OPEN
CLOSE
PRINT
INPUT
INKEY$
Television
Function
open a channel for
I/O
close a previously opened channel
output
to
a channel
input from a channel
Input a character from a channel
12/84