EasyManua.ls Logo

Commodore 1570 - Page 76

Commodore 1570
132 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...
BLOCK-READ
The purpose
of
a BLOCK-READ
is
to
load the contents of a specified sector into a
file buffer. Although the BLOCK-READ command (B-R)
is
still part
of
the DOS
command set, it
is
nearly always replaced
by
the U I command (See Chapter 8).
FORMAT FOR THE BLOCK-READ COMMAND:
PRINT#15,
"UI";
channel
#;
drive
#;
track
#;
sector #
where "channel
#"
is
the channel number specified when the
file
into which the block
will be read was opened, "drive
#"
is
the drive number, and "track
#"'and
"sector
#"
are respectively the track and sector numbers containing the desired block of data to be
read into the
file
buffer.
ALTERNATE FORMATS:
PRINT#
15,
"UI
:"channel #;drive #;track #;sector #
PRINT#15,"UA:"channel
#;drive #;track #;sector #
PRINT#15,"UI:channel
#,drive
#,track
# ,sector
#"
EXAMPLE:
Here is a complete program to read a sector into disk memory using U I, and from
there into computer memory via
GET#,
(If a carriage return will appear
at
least once
in
every
88
characters
of
data, Input# may
be
used
in
place
of
GET#).
110MB
= 7936:REM
$1
FOO
120 INPUT"TRACK TO READ";T
130 INPUT"SECTOR TO READ";S
140 OPEN 15,8,15
150 OPEN
5,8,5,"#"
160
PRINT#15,"UI
";5;0;T;S
170 FOR
1=
MB
TO
MB
+
255
180
GET#5,A$:IF
A$
0="
"
THEN A$ = CHR$(O)
190 POKE
I,ASqA$)
200 NEXT
210 CLOSE 5:CLOSE
15
220 END
Define a memory buffer.
Select a track
and sector.
Opcn command channel.
Open direct access channel.
Read sector into disk buffer.
Use a loop
to
copy disk buffer.
into computer memory.
Tidy
up
after.
As the loop progresses, the contents of the specified track and sector are copied into
computer memory, beginning
at
the address set
by
variable
MB
in
line 160, and may be
examined and altered there,
68

Related product manuals