EasyManua.ls Logo

Commodore Plus 4 - Page 355

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
343
fUenximber"B-l£:"channel;drive;track;sector
where
filenumber
is
the
logical
file
number
of
the
command
channel,
channel
is
the
channel
number
of
the
direct-access
channel,
and
drive
is
the
drive
number.
The
track
can
be
any
track
on
the
diskette
(1
to
35)
and
the
sector
any
sector
of
that
track.
Example:
This
example
should
be
run
only
on
a
formatted
disk
containing
no
information
you
want
to
preserve.
The
program
writes
a
short
machine-language
subroutine
onto
sector
0
of
track
1,
then
block
executes
that
sector.
The
subroutine
examines
the
1541's
memory
to
determine
which
of
its
internal
buffers
(0
through
7)
is
being
used,
stores
this
information
in
the
buffer
for
the
BASIC
program's
retrieval,
and
returns.
10
OPEN15,8,15,"I"
20
IFDSO0THENPRINTDS$:GOTO160
30
OPEN1,8,2,"#"
40
IFDSO0THENPRINTDS$:QOTO160
50
PRINT#15,lfB-P:";2;0
60
FORI=0TO6:READN
70
PRINT#1,CHR$(N);
80
NEXT
90
PRINT#15,"U2:"2;0;1;0
100
IFDSO0THENPRINTDS$:GOTO160
110
PRINTS15,"B-E:";2;0;1;0
120
IFDSO0THENPRINTDS$:GOTO160
130
PRINTS15,"B-P:";2,-7
140
GET#1,A$
150
PRINT"USING
BUFFER:
";ASC(A$)
160
CLOSE1:CLOSE15
170
DATA
160,7,165,249,145,48,96
Line-by-Line
Explanation
10
Open
the
command
channel
and
initialize
the
disk.
20
Check
for
error.
If
an
error
is
present,
exit.
30
Open
a
direct
access
channel.
40
Check
for
error.
If
an
error
is
present,
exit.
50
Set
buffer
pointer
to
byte
0.
60
I
counts
the
bytes
in
the
machine-language
routine.
70
Put
a
byte
in
the
buffer.
80
Go
on
to
the
next
byte.
90
Write
buffer
out
to
track
1,
sector
0.