Download Print this page

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

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
230 LSET NX$
=
MKI$
(HX1)
240 PUT
i
t
R%
245
RX
=
NX*
'USE
NEXT ALPHA* LINK
AS
DEFAULT
FOR NEXT
RECORD
250 CLS
:
PRINT
n
TYPE <ENTER>
TO
READ NEXT ALPHA* ENTRY,":
PRINT"
OR
RECORD
#
<EIMTER>
FOR
SPECIFIC ENTRY,":
INPUT
"
OR
<
ENTER)
TO
QUIT'S
RX
2S0
IF
0<RX
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:
300 REM
GL0SS0UT/BAS
«
310 CLS
s
CLEAR 300
320 OPEN
"R"
>
1*
"GLOSSARY/BAB"
330 FIELD
1*
IB
AS
ND$
*
238
AS
MEANING*,
2
AS
NX*
340 INPUT "WHICH
RECORD
IS
FIRST ALPHABETICALLY"
5
HI
350 GET
1
t
HI
3S0 PRINT
:
PRINT WD*
370 PRINT
MEANING*
380
HI
=
CUI(NX$)
39-0
INPUT "PRESS
<EIMTER> TO
CONTINUE"
5
X
400
IF
HI <>
THEN 350
410 CLOSE
420 END
154

Advertisement

loading