EasyManua.ls Logo

Tandy TRS-80 - Page 65

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...
SHUFFLING DISK FILES
CLASS ROSTER PROGRAM
10 cls
28 PRINT "BASIC/CLS" : PRINT
30 OPEN "I".
«1»
"BASIC/CLS"
38
IF
EOFU)
=
-1
THEN 80
50
INPUT »1»
A*
S0
PRINT A$
70 goto aa
B0 CLOSE
»1
Note: Substitute "ASSEMBLY
/CLS"
for
"BASIC/
CLS" in lines 20 and 30 to print the class roster
of
the
assembly language class.
The "Class Assignment Program" has three buff-
ers open at the same time. Because of this, you are
able to communicate with three disk files at the
same time.
Line
10 reserves
memory for
these three buffers.
Lines
20-40
OPENs the three
buffers. Then,
line
60
INPUTs
a
student
from
"COMPUTER/SCH"
into buffer
#3.
Line 100 WRITEs the name
of
the
student to
either buffer
#1 ("BASIC/CLS") or buffer
#2
("ASSEMBLY/CLS").
When all the students from
buffer
#3 ("STU-
DENT/SCH")
have been input, line 50 sends the
Computer to lines
120-140,
which
CLOSEs
the
three buffers.
CROWDING THE BUFFER
There's one more thing you'll like about FILES.
Erase memory, type, and RUN:
10 CLEAR
£100
20 files 1 , am
30 A$
=
"NORMALLY
t
YOU WILL NOT
BE ABLE TO
PUT ALL OF THESE SENTENCES
IN A DISK
FILE AT THE SAME TIME.
"
£10
B$
=
"THIS IS BECAUSE, WITHOUT USING
FILES,
YOU WILL ONLY HAVE A TOTAL OF
25G
BYTES
OF BUFFER SPACE.
"
50 C$
=
"IN THIS
PROGRAM*
WE'VE RESERVED
£100
BYTES OF BUFFER
SPACE,
"
E0 D$
=
"THIS WAY YOU CAN
SEND ALL OF
THESE SENTENCES
TO THE BUFFER AT THE
SAME TIME.
"
70 E*
=
"WHICH
WILL OUTPUT THEM ALL TO THE
DISK
FILE AT
ONCE,
"
80 OPEN
"0"
, »1 ,
"WORD/DAT"
90 WRITE
#1
. A*. B$
,
C$ ,
Dt
,
Et
100 CLOSE
#1
Want to input this
paragraph? Add
these lines and
RUN:
200 OPEN "I" ,
#1
,
"WORD/DAT"
210 INPUT
#1
, At,
Bt, Ct,
Dt t E$
220 CLS
230 PRINT At; Bt; Cti
Dt
!
E$
240 CLOSE
#1
Note:
You can make the
buffer
as targe as you want
CHAPTER
CHECKPOINT
How
mustyou SAVEa program which yo,
wUl want to MERGE?
When
the two programs you're mergin
both have
the same line numbers, whic.
lines prevail?
How many buffers
does the Compute
reserve when it starts-up?
How
much
hunter space does it reserve?
What
does
FILES
3,
3000 mean?
2.
3,
4.
5.
55

Related product manuals