Download Print this page

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

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

Advertisement

TRS-80
MODEL
III
DISK
SYSTEM
50
IZ=IZ+1
G0
G0T
f
30
70
CLOSE
'
Conversion factors
have been
read-in
100 CLS:
PRINT TAB(5)"*** English
to
Hetric Conuersions ***"
110
FOR ITEM'^B
TO 12-1
120
PRINT TAB(9) 5USING"
(##
)
1
%
«
5ITEMZ*
UNIT$(ITEMI)
130
NEXT
140
PRINT
@
704* "Which
conversion
(0-B)"
i
150
INPUT
CHOICER
1G0
INPUT
i!
Er,ter
English quantity"
5V
170
PRINT"The Metric equivalent
is"
0*FACTR(CH0ICE2)
180
INPUT"Press (ENTER)
to
continue"
5X
190
PRINT
@
704*
CHRtOl)
'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
INPUT*!* UNIT*<n,):
INPUT#1 ,FACTR
(
11
How
to
update a
file
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