EasyManua.ls Logo

Commodore 1581 - The Buffer Pointer

Commodore 1581
138 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
BUFFER
POINTER
The
buffer
pointer
points
to
where
the
next
READ
or
WRITE
will
begin
within
a
disk
memory
buffer.
By
moving
the
buffer
pointer,
you
can
access
individual
bytes
within
a
block
in
any
order.
This allows
you
to
edit
any
portion
of
a
sector,
or
organize
it
into
fields,
like
a
relative
record.
FORMAT
FOR THE
BUFFER-POINTER
COMMAND:
PRINT#15,uBUFFER-POINTERn;channel#;byte
usually
abbreviated
as:
PRINT#15,"B-P";channel
#;byte
where
"channel
#"
is
the
channel
number
specified
when
the
file
reserving
the
buffer
was
opened,
and
ubyte"
is
the
character
number
within
the
buffer
at
which
to
point
(from
0
through
255).
ALTERNATE
FORMATS:
PRINT#15,"B-P:"channel
#;byte
PRINT#15,"B-P:channel
#;byte"
EXAMPLE:
Here
is
a
program
that
locks
the
first
program
or
file
on
a
diskette.
It
works
by
reading
the
start
of
the
directory
(Track
40,
Sector
3)
into
disk
memory,
setting
the
buffer
pointer
to
the
first
file
type
byte
(see
Appendix
C
for
details
of
directory
organization),
locking
it
by
setting
bit
6
and
rewriting
it.
110
OPEN
15,8,15
Open
command
channel.
120
OPEN
5,8,5,"#"
Open
direct
access
channel.
130
PRINT#15/'Ul";5;0;40;3
Read
Track
40,
Sector
3.
140
PRINT#15,"B-P";5;2
Point
to
Byte
2
of
the
buffer.
15OGET#5A$:IFA$
=
""
THEN
A$
=
CHR$(0)
Read
it
into
memory.
160
A=ASC(A$)
OR
64
Turn
on
bit
6
to
lock.
170
PRINT#15,"B-P";5;2
Point
to
Byte
2
again.
180
PRINT#5,CHR$(A);
Overwrite
it
in
buffer.
190
PRINT#15,uU2";5;0;40;3
Rewrite
buffer
to
diskette.
200
CLOSE
5
Tidy
up
after.
210
CLOSE
15
220
END
74

Table of Contents

Other manuals for Commodore 1581

Related product manuals