EasyManua.ls Logo

Tandy TRS-80 - Page 63

Tandy TRS-80
104 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
•t %
t
*
I
I
SHUFFLING
DISK
FILES
(Merging
programs,
using
many
buffers)
Because storing
and retrieving
disk files
is
so easy,
you will want
to use them
as
much
as you
can.
In
this chapter, we're
going to talk
about some
spe-
cial
ways you
can
use them.
MERGING
PROGRAM
FILES
With the first
method, you can
build a
program
out of related
program
"modules"
SAVEd on disk.
You can then
MERGE
any of
these
program files
with
whatever
program
you have in
memory.
Type
and SAVE
these two
related
programs:
10 REM AGE
CONVERSION
TO MONTHS
20
N
=
N
*
12
30
A*
=
STR*(N)
+
"
MONTHS"
S A U
E "MONTHS/AGE", A
(ENTER)
10 REM
AGE CONVERSION
TO WEEKS
20 N
=
N *
52
30
A* =
STRt(N) +
"
WEEKS"
Be
sure to type the A
when
you SAVE these
pro-
grams.
We'll
explain
why later .
. . Erase memory.
Now
put this
program
in memory:
5
INPUT "TYPE
YOUR AGE" i
N
40 PRINT
"YOU HAVE
LIVED" A$
and
combine
it with one
of
the programs
you
SAVEd.
Type:
SAVE
"WEEKS/AGE",
A
(ENTER)
MERGE
"MONTHS/AGE"
(ENTERl
LIST
the program
. . . The Computer
has MERGEd
"MONTHS/AGE"
with
the program
you have in
memory.
Notice
the
line
numbers
are the
same as
they
were
in each individual
program.
At this
point, this
is
the program
you have in
memory:
5
INPUT "TYPE
YOUR AGE"
i N
10 REM AGE
CONVERSION
TO
MONTHS
20 N
=
N
*
12
53

Related product manuals