Download Print this page

Radio Shack TRS-80 Owner's Manual page 166

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

Advertisement

J.?,r
TRS-80
MODEL
ill
DISK
SYSTEM
50
11=11+1
60
GOTp
30
70
CLOSE
'
Conversion factors
have been
read-in
100 CLS:
PRINT TAB(5)"**# English
to
Metric Conversions
***"
110
FOR ITEM%=0
TO II-
120
PRINT TABC9) !USING"(»#
)
I
X
"UTEM%»
UNIT*(ITEM%)
130
NEXT
140
PRINT
@
704
j
"Which conversion
(0-6)
"5
150
INPUT
CHOICE!
1G0
INPUT "Enter English quantity"
IU
170
PRINT"The Metric equivalent
is"
M*FACTR(CHOICE%)
180
INPUT"Press <ENTER>
to
continue"
5X
190
PRINT
@
704
,
CHR$(31)
'clear
to
end
of
frame
200 GOTO 140
Line
20 opens
the
file
for sequential input,
input begins
at
the
beginning of
the
file.
Line
30 checks
to
see
that
the end-of-file record hasn't
been
reached.
If
it
has,
control
branches
from
the disk input
loop
to
the part
of
the
program
that
uses
the
newly
acquired
data.
Line
40
reads
a
value
into the string array
unit$(
),
and
a
number
into the
single-precision array
factr(
).
Note
that
this
input
list
parallels
the
print#
list
that
created the data
file
(see the section
"Sequential Output:
An
Example").
This parallelism
is
not required,
however.
We
could
just as
successfully
have
used:
40
INPUTslt UNIT$(I%);
INPUT*! »FACTR
(
1%
)
How
to
update a
lie
Suppose you want
to
add
more
entries into
the
English- Metric conversion
file.
You
could simply
re-Open
the
file
with
mode
=
e
and
print#
the extra data.
Or,
you might want
to
leave
the old
file
intact
and
output
a
new
file:
1
Open
the
file
for
sequential input
(Mode
=
i)
2.
Open
another
new
data
file
for sequential
output
(Mode
=
o)
3.
Input a
block of
data
and update
the
data
as
necessary
4.
Output
the data
to
the
new
file
5.
Repeat
steps 3
and 4
until
all
data has
been
read,
updated,
and
output
to
the
new
file;
then
go
to
step
6
6.
Close both
files
148

Advertisement

loading

This manual is also suitable for:

Model iii