EasyManua.ls Logo

Commodore 1570 - Page 77

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-WRITE
The purpose
of
a BLOCK-WRITE
is
to
save the contents
of
a
file
buffer into a
specified sector. It
is
thus the reverse
of
the
BLOCK-READ command. Although the
BLOCK-WRITE command (B-W)
is
still part
of
the DOS command set,
it
is
nearly
always replaced by the
U2
command.
FORMAT FOR THE BLOCK-WRITE COMMAND:
PRINT#15, "U2";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 that should receive the block
of
data being
saved from the file buffer.
ALTERNATE FORMATS:
PRINT#15,"U2:"channel
#;drive #;track #;sector #
PRINT#15,"UB:"channel
#;drive #;track #;sector #
PRINT#15,"U2:channel
#,drive
#,track
#,sector
#"
EXAMPLES:
To restore track 18, sector 1
of
the directory from the disk buffer filled
by
a BLOCK-
READ, use:
PRINT#15,'
'U2'
';5;0;18;1
You'll return
to
this example on the next page, after you learn
to
alter
the
directory
in
a
useful way.
You can also
use
a BLOCK-WRITE
to
write a name
in
Track
1,
Sector I, a rarely-
used sector. This can be used
as
a way of marking a diskette as belonging
to
you. Here
is
a
program
to
do it, using the alternate form
of
the BLOCK-WRITE command:
110 INPUT"YOUR NAME";NA$
120 OPEN 15,8,15
130 OPEN
4,8,4,"#"
140
PRINT#4,NA$
150 PRINT#15,"U2";4;0;1;1
160 CLOSE 4
170
CLOSE
15
180 END
69
Enter a name.
Open command channel.
Open direct access channel.
Write name
to
buffer.
Write buffer
to
Track
1,
Sector I
of
diskette.
Tidy
up
after.

Related product manuals