Download Print this page

Radio Shack TRS-80 Owner's Manual page 162

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

Advertisement

5ISK
S^S^EM
a$
becomes
a
two-byte
representation
of
the Integer portion
of
8/1.
Any
fractional
portion
is
ignored.
Note
that
a$
in this
case
is
a
normal
string
variable,
not a
buffer-field
name.
Suppose baseball/bat
(a
non-standard lie
extension)
has
been opened
for
random
access using buffer
2,
and
the
buffer has
been
FiELDed
as
follows:
held:
NM$
YRS$
AVG$
HR$
AB$
ERNING$
length:
16
2
4
2
4
4
nm$
is
intended
to
hold
a character
string;
avg$, ab$ and
ernings, converted
single-precision values;
yrs$ and
hr$, converted
integers.
Suppose
we
want
to
write the
following data
record:
slow learner
played 38
years; lifetime batting
average
.
123;
career
homeruns,
11;
at
bats,
32768;..., earnings
-
13.75.
Then we'd
use
the
make-string
functions as follows:
1000
LSET NM$="SL0W LEARNER"
1010
LSET YRS$=MKI*(38)
1020
LSET AMG$=MKS$(
,123)
1030 LSET
HR$=MKI$(11)
1040 LSET
AB$=HKS$(327G8)
105B LSET
ERNING*=MKS*(-13,75)
After
this
sequence,
you
can
write
slow
learner's
information
to
disk
with
the
put
statement.
When
you
read
it
back from
disk
with get,
you
will
need
to
restore the
numeric
data
from
string to
numeric
form, using cvi
and
cvs
functions.
144

Advertisement

loading

This manual is also suitable for:

Model iii