EasyManua.ls Logo

Commodore Plus 4 - Page 363

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
Disk
Drive
381
Saving,
Loading,
and
Verifying
Files
The
key
subroutines
for
saving
and
loading
sections
of
RAM
are
S
AVESP
($FFD8)
and
LO
ADSP
($FFD5).
Using
these
routines
is
ideal
for
saving
sections
of
memory
into
a
disk
file
for
later
retrieval.
The
routines
automatically
perform
the
appropriate
operations
on
the
serial
bus.
The
messages
printed
to
the
screen
during
these
operations
are
con
trolled
by
the
message
flag
set
with
SETMSG
($FF90).
Save
When
a
section
of
memory
is
saved
to
disk,
a
file
name
must
be
provided.
The
name
is
1
to
16
characters
in
length
and
must
be
stored
in
CHR$
codes
in
ascending
order
somewhere
in
memory.
The
following
outlines
the
operations
required:
1.
Store
the
low
and
high
bytes
of
the
address
at
which
the
save
is
to
begin
into
2
consecutive
bytes
on
zero
page.
2.
Load
.X
with
the
device
number
of
the
disk
drive
and
call
SETLFS
($FFBA).
3.
Load
.A
with
the
length
of
the
file
name,
.X
with
the
low
byte
of
the
address
at
which
the
name
is
stored,
and
.Y
with
the
high
byte
of
the
address
at
which
the
name
is
stored,
and
call
SETNAM
($FFBD).
4.
Load
.A
with
the
address
of
the
zero
page
location
in
which
the
begin
save
address
is
stored
(see
step
1
above).
Load
.X
with
the
low
byte
of
the
address
at
which
to
stop
saving
plus
1.
Load.
Y
with
the
high
byte
of
the
address
at
which
to
stop
saving
plus
1.
Call
SAVESP
($FFD8).
5.
Check
for
errors
by
checking
the
carry
status
and
the
status
variable
and
by
reading
the
disk
error
channel.
The
status
variable
can
be
loaded
into
.A
with
READSS
($FFB7).
Load
When
a
file
is
to
be loaded
into
memory,
the
file
name
by
which
it
is
known
on
the
diskette
must
be
stored
in
CHR$
codes
in
ascending
order
somewhere
in
memory.
The
following
outlines
the
operations
required:
1.
Load
.X
with
the
device
number
of
the
disk
drive.
Load
.Y
with
$00
for
a
relocated
load,
or
a
nonzero
value
for
a
nonrelocated
load.
Call
SETLFS
($FFBA).
2.
Load
.A
with
the
length
of
the
file
name,
.X
with
the
low
byte
of
the
address
at
which
the
name
is
stored,
and.
Y
with
the
high
byte
of
the
address
at
which
the
name
is
stored,
and
call
SETNAM
($FFBD).