Download Print this page

Radio Shack TRS-80 Owner's Manual page 168

Mini-disk operation disk operating system disk basic programming language
Hide thumbs Also See for TRS-80:

Advertisement

Li
RS-80
MODEL
111
DISK
SYSTEM
Random
Access Techniques
Random
access
offers several
advantages over
sequential access:
Instead of
having
to
start
reading
at
the
beginning of a
file,
you
can
read
any
record
you
specify.
8
To
update
a
file,
you
don't
have
to
read
in
the entire
file,
update
the data,
and
write
it
out
again.
You
can
rewrite or
add
to
any
record
you
choose, without
having
to
go
through any of
the other records.
8
Random
access
is
more
efficient
data takes
up
less
space
and
is
read
and
written
faster.
"
Opening
a
file
for direct
access allows
you
to
write
and
read
from
the
file
via
the
same
buffer.
Random
access provides
many
powerful
statements
and
functions
to
structure
your
data.
Once
you have
set
up
the
structure, direct
input/output
becomes
quite simple.
The
last
advantage
listed
above
is
also the
"hard
part" of
direct access.
It
takes
a
little
extra thought.
For
the
purposes of
direct
access,
you
can
think
of
a disk
file
as a
set
of
boxes
like
a wall
of
post-office
boxes.
Just
like
the
post
office
receptacles, the
file
boxes
are
numbered.
We
call
these
boxes
"records."
You
can
place data
in
any
record, or read the contents of
any
record,
with
statements
like:
PUT
1
»5
write buffer-
1
contents
to
record
5
GET
1
»
5
read the contents of record
5 into buffer-
In
Figure
14,
we
assume
a record length of 256.
#6
'256
iBYTES,
#1
(256
)
\bytes/
#7
){l
56
'
erresy
#2
(lAts)
#8
(258
\
\
bytes;
#3
#9
\B
7
"'
m
(256
)
VBYTES/
#10
mi
RECORDS
IN
DISK
FILE
Figure
14.
get and
put.
I/O
BUFFERS
IN
RAM
150

Advertisement

loading

This manual is also suitable for:

Model iii