Download Print this page

Radio Shack TRS-80 Owner's Manual page 172

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

Advertisement

TRS-80
MODEL
1(1
DISK
SYSTEM
230 LSET NX$
=
MKI*
(NXX)
240 PUT
I
>
Rl
245 R%
=
NX%
'USE
NEXT ALPHA, LINK
AS
DEFAULT FOR NEXT RECORD
250 CLS
:
PRINT
"
TYPE <ENTER>
TO
READ NEXT ALPHA, ENTRY*";
PRINT"
OR
RECORD
«
<ENTER>
FOR
SPECIFIC ENTRY*":
INPUT
"
OR
<
ENTER)
TO
QUIT'S
RI
260
IF
0<R%
THEN
140
270 CLOSE
280 END
Notice
we've added
a
field,
nx$,
to
the
record
(line
120).
nx$
will
contain
the
number
of
the
record
which comes
next
in
alphabetical
sequence. This enables
us
to
proceed
alphabetically
through
the glossary,
provided
we know
which
record contains the entry
which
should
come
first.
For example, suppose
the glossary contains:
record#
word
(WD$)
defn,
pointer to
next
alpha, entry
(NX$)
1
2
3
4
LEFT-JUSTIFY
BYTE
RIGHT-JUSTIFY
HEXADECIMAL
3
4
1
When we
read record 2 (byte),
it
tells
us
that
record
4 (hexadecimal)
is
next,
which
then
tells
us record
1
(left- justify)
is
next,
etc.
The
last
entry,
record
3
(right- justify), points us
to zero,
which
we
take
to
mean "The
End."
Since
nx$
will
contain an
integer,
we
have
to
first
convert
that
number
to
a
two-
byte
string
representation,
using
mki$
(line
230
above).
The
following
program
displays the glossary
in
alphabetical
sequence:
3BB REM
,,,
GL0SS0UT/BAS
,,,
31B CLS
:
CLEAR 300
320 OPEN
"R"
t
1,
"GLOSSARY/BAS"
330 FIELD
I*
IB
AS
WD$
,
238
AS
MEANING*
»
2
AS NX*
340 INPUT "WHICH
RECORD
IS
FIRST ALPHABETICALLY";
HI
351 GET
1
t
NX
360 PRINT
:
PRINT WD$
370 PRINT
MEANING*
38i NX
=
CM
I
(NX*)
388 INPUT "PRESS
<ENTER>
TO
CONTINUE"?
X
400
IF
NX <>
THEN 350
410 CLOSE
421 END
i..-*
-
.-.-;
f-H>^%-^"^frA;;*--Vi
154

Advertisement

loading

This manual is also suitable for:

Model iii