EasyManua.ls Logo

Commodore Plus 4 - Page 364

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...
352
Using
Peripheral
Devices
3.
Load
.A
with
$00
to
indicate
a
load.
If
it
is
to
be
a
relocated
load,
load
.X
with
the
low
address
to
begin
loading,
and.
Y
with
the
high
address
to
begin
loading.
Call
LOADSP
($FFD5).
4.
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).
A
normal
load
sets
bit
6
of
the
status
variable
to
1,
meaning
that
the
end-of-file
was
reached.
Verify
When
a
file
is
to
be
verified
against
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
verify,
or
a
nonzero
value
for
a
nonrelocated
verify.
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).
3.
Load
.A
with
$01
(or
other
nonzero
value)
to
indicate
a
verify.
If
it
is
to
be
a
relocated
verify,
load
.X
with
the
low
address
to
begin
verifying
and.
Y
with
the
high
address
to
begin
verifying.
Call
LOADSP
($FFD5).
4.
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).
A
normal
verify
sets
bit
6
of
the
status
variable
to
1,
meaning
that
the
end-of-file
was
reached.
A
verify
error
sets
bit
4
of
the
status
variable
to
1
as
well.
Example:
^This
example
program
saves
itself
on
disk,
verifies
the
resulting
file
against
itself,
'
and
performs
a
relocated
load
of
the
file.
No
call
to
SETMSG
is
made.
If
the
program
is
executed
from
the
machine-language
monitor,
monitor
messages
are
printed
to
the
screen.
The
program
is
in
two
parts,
the
main
one
at
$2000
and
a
routine
to
read
the
disk
drive's
error
channel
at
$2080.
Some
CHR$
data
are
required
at
memory
locations
$20F8
and
$2100.
It
is
shown
after
the
program.
Low
byte
of
the
begin
save
address.
Store
on
zero
page
High
byte
of
the
begin
save
address•
Store
in
next
byte
on
zero
page.
Device
number of
disk
drive.
SETLFS.
Length
of file
name.
.
2000
.
2002
.
2004
.
2006
.
2008
.
200A
.
200D
A9
85
A9
85
A2
20
A9
00
D8
20
D9
08
BA
06
LDA
STA
LDA
STA
LDX
FF
JSR
LDA
#$00
$D8
#$20
$D9
#$08
$FFBA
#$06