EasyManua.ls Logo

Commodore Plus 4 - Page 359

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
347
Line-by-Line
Explanation
10
Open
the
command
channel.
20
Check
for
error.
If
an
error
is
present,
exit.
30
Construct
a
string
containing
the
machine-language
subroutine.
40
Write
the
subroutine
into
the
1541's
memory
at
$0500.
50
Execute
the
machine-language
subroutine.
60
Retrieve
the
saved
count
from
the
1541's
memory.
70
Get
the
count.
80
Print
it
out.
90
Close
the
command
channel.
100
The
data
are
this
machine
code
routine:
$0500
LDY
#$00
Count
of
active
buffers
found.
$0502
LDX
#$06
Pointer
to
which
buffer
checking.
$0504
LDA
$A7,X
Get
channel
number
of
this
buffer.
$0506
CMP
#$FF
Compare
to
inactive
buffer
value.
$0508
BEQ
$050B
If
equal,
skip
next
instruction.
$050A
INY
Increment
the
count.
$050B
DEX
Decrement
the
pointer.
$0500
BPL
$0504
If
not
done,
go
back
to
get
next
the
channel
number.
$050E
STY"
$1B
Store
count
for
BASIC
program's
retrieval.
$0510
RTS
Return.
UnSCRATCHing
a
Disk
File
When
the
disk
drive
is
instructed
to
SCRATCH
a
file,
it
does
not
actually
remove
the
file's
contents
from
the
diskette.
Instead,
it
changes
a
byte
in
the
diskette's
directory
to
indicate
that
the
file
was
SCRATCHed
and
deallocates
all
of
the
file's
sectors
in
the
BAM.
If
you
discover
that
you
have
SCRATCHed
an
important
file
for
which
you
have
no
backup,
you
can
sometimes
recover
the
file.
It
is
important
to
note
that
this
procedure
is
for
EMERGENCIES
only.
This
is
NOT
a
recommended
procedure.
It
is
far,
far
better
to
keep
plenty
of
backup
copies
of
all
of
your
work.
If
you
must
try
it,
please
note
the
following:
1.
Your
chances
of
success
are
MUCH
better
if
NOTHING
has
been
written
to
the
diskette
since
the
SCRATCH
occurred.
Do
not
try
this
procedure
if
you
performed
disk
write
operations
after
the
SCRATCH.