EasyManua.ls Logo

Commodore Plus 4 - Page 366

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...
354
Using
Peripheral
Devices
209A
A9
0D
LDA
#$0D
Carriage
return
character.
209C
20
D2
FF
JSR
$FFD2
Send
to
screen.
209F
20
CF
FF
JSR
$FFCF
Get
a
character
from
command
channel.
20A2
20
D2
FF
JSR
$FFD2
Send
to
screen.
20A5
C9
0D
CMP
#$0D
Compare
to
carriage
return.
20A7
D0
F6
BNE
$209F
If
not,
get
another
byte.
20A9
A9
0F
LDA
#$0F
Logical
file
number
of
command
channel.
20AB
20
C3
FF
JSR
$FFC3
CLOSE.
20AE
20
CC
FF
JSR
$FFOC
CLRCH.
20B1
00
BRK
Stop
processing.
The
following
data
need
to
be
placed
in
memory:
>20P8
52
4F
52
52 45
20 00
00
:PRORRE..1
>2100
53
41
56
50 52
47
00
00
:1SAVPRG..|
Using
Data
Files
This
section
outlines
the
machine-language
equivalents
for
the
BASIC
statements
OPEN,
CLOSE,
GET#,
and
PRINT#.
They
can
be used
for
all
the
purposes
outlined
in
the
preceding
BASIC
sections,
including
data-file
handling
and
direct-access
programming.
The
key
subroutines
are
OPEN
(SFFCD),
CLOSE
(SFFC3),
CHKIN
(SFFC6),
CHOUT
(SFFC9),
CLRCH
(SFFCC),
BASIN
(SFFCF),
and
BSOUT
(SFFD2).
Any
messages
printed
to
the
screen
during
these
operations
are
controlled
by
the
message
flag
set
with
SETMSG
($FF90).
Open
When
a
file
is
to
be
opened,
and
a
file
name
must
be
provided,
the
name
(1
to
16
characters)
and
the
type
of
file
and
mode
(see
the
BASIC
section
on
OPENing
data
files)
must
be
stored
in
CHR$
codes
in
ascending
order
somewhere
in
memory.
Exactly
the
same
situation
exists
as in
BASIC.
That
is,
if
the
type
and
mode
are
omitted,
the
mode
is
assumed
to
be
read,
and
the
type
is
the
existing
type
of
the
file.
A
direct-access
channel
can
be
opened
by
using
a
pound
sign
for
the
file
name.
The
following
outlines
the
operations
required:
1.
Load
.A
with
the
logical
file
number
to
use
for
the
file,
.X
with
the
device
number
of
the
disk
drive,
and
.Y with
the
channel
number.
Call
SETLFS
($FFBA).
2.
Load
.A
with
the
length
of
the
file
name
(0
if
no
name), .X
with
the
low
byte
of
the
address
where
the
file
name
is
stored,
and
.Y
with
the
high
byte
of
the
address
where
the
file
name
is
stored.
Call
SETNAM
($FFBD).
3.
Call
OPEN
($FFC0).
4.
Check
for
errors
by
examining
the
carry
bit
and
the
disk
error
channel.
The
status
byte
is
not
particularly
useful for
discovering
OPEN
errors.