Download Print this page

Radio Shack TRS-80 model III Owner's Manual page 136

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

Advertisement

DISK
BASIC
buffer
from
basic
so
that
you
can
either
read
the data
it
contains or place
new
data
in
it.
The
field statement provides
the
means
of
access.
You
may
use
the
held
statement
any
number
of times
to
"re-organize"
a
file
buffer.
FiELDing
a buffer
does
not
clear the
contents of the
buffer;
only
the
means
of accessing
the
buffer
(the
field
names)
are
changed. Furthermore,
two
or
more
field
names
can
reference
the
same
area
of
the buffer.
Examples
FIELD
1
f
128 AS A$
,
128 AS B$
This statement
tells
basic
to
assign the
first
128
bytes of
the buffer
to
the
string
variable
a$ and
the
remaining 128
bytes
to b$.
If
you
now
print
a$ and
b$,
you
will
see the contents
of
the buffer.
Of
course,
this
value
would
be meaningless
unless
you have
used
get
to
read
a
256-byte record
from
disk.
Note:
All data
both
strings
and numbers
must
be placed
into
the buffer
in
string
form.
There
are three pairs
of
functions
(mki$/cvi,mks$/cvs,mkd$/cvd)
for
converting
numbers
to strings
and
vice- versa.
See "Functions"
below.
FIELD
IS
AS
NM$
>
25 AS AD$
,
10
AS CY*
»
2
AS
ST$
H
AS ZP$
The
first
16 bytes of buffer
3 are
assigned
the buffer
name
nm$;
the
next
25,
ad$;
the
next
10,
cy$;
the
next
2,
st$
and
the
next
7, zp$.
The
remaining 196
bytes
of
the buffer are
not
fielded
at
all.
More
on
field
names
Field
names,
like
nm$,ad$,cy$,st$,
and
zp$, are
not
string
variables
in
the
ordinary
sense.
They
do
not
consume
the
string
space
available
to
basic.
Instead,
they point
to
the buffer
field
which you
assigned with
the
field
statement. That's
why
you
can
use:
100
FIELD
1
,255 AS A$
without worrying about
whether 255
bytes of
string
space
are available for a$.
If
you
use a
buffer
field
name
on
the
left
side
of
an
ordinary
assignment
statement,
that
name
will
no
longer point
to
the buffer
field;
therefore,
you
won't be
able
to
access
that
field
using
the
previous
field
name.
For example,
A$
=
B$
nullifies
the effect
of
the
field statement
above
(line
100).
During
random
input, the
get
statement places data
into
the
255-byte
buffer,
where
it
can be accessed
using
the
field
names
assigned
to that buffer.
During
random
output,
lset and rset
place data
into
the
buffer,
so
you
can
then
put
the
buffer contents
into a
disk
file.
135

Advertisement

loading