EasyManua.ls Logo

Commodore Plus 4 - Page 401

Commodore Plus 4
464 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The
Modem
and
Other
RS232
Devices
389
Using
an
RS232
Device
from
Machine
Language
The
RS232
port
is
handled
the
same
way
in
machine
language
as
in
BASIC.
The
status
variable
is
read
with
READSS.
Open
When
the
file
is
to
be
opened,
the
control
and
command
registers
(two
characters)
must
be
stored
in
ascending
order
somewhere
in
memory.
The
following
outlines
the
operations
required:
1.
Load
.A
with
the
logical
file
number
to
use
for
the
file,
.X
with
$02
(the
device
number
of
the
RS232
port),
and
.Y
with
$FF
(to
signify
no
secondary
address).
Call
SETLFS
($FFBA).
2.
Load
.A
with
the
length
of
the
register
information
(usually
2),
.X
with
the
low
byte
of
the
address
where
the
registers
are
stored,
and
.Y with
the
high
byte
of
the
address
where
the
registers
are
stored.
Call
SETNAM
($FFBD).
3.
Call
OPEN
($FFC0).
4.
Check
for
errors
by examining
the
carry
bit.
Close
Files
can
be
closed
individually
with
the
CLOSE
($FFC3)
routine:
1.
Load
.A
with
the
logical
file
number
of
the
file
to
be
closed.
Call
CLOSE
($FFC3).
2.
Check
for
errors
by
examining
the
carry
bit.
All
the
files
in
use
can
be
closed
and
the
input
and
output
channels
reset
to
their
default
devices
by
calling
CLALL
($FFE7).
Print
To
send
information
to
the
RS232
port,
the
port
must
have
been
opened.
The
following
outlines
the
operations
required:
1.
Load
.X
with
the
logical
file
number
of
the
output
file.
Designate
it
as
the
output
channel
by
calling
CHOUT
($FFC9).
2.
Check
the
status
byte
for
errors.