Radio Shack TRS-80 Model 100 Basic Manual page 133

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

Experiment #4 Reading a Cassette File
In this experiment, the cassette data file which you created in Experiment 3 will be
read and displayed. Load program "EXP2" from RAM using the command
LOAD" EXP2"
(ENTER)
and change line 500 to
500 CLS:oPEN"CAS:NAMES" FOR INPUT AS 1
List the program to verify that it is
500 CLS : oPEN"CAS : NAMES" FOR INPUT AS 1
510 INPUT #1, N$ : PRINT N$
520 IF NOT EoF(l) GoTo 510
530 CLOSE
Rewind the tape, press PLAY and execute the program. The cassette recorder will
start and you will hear some sound coming from computer speaker. When the last
name is read from the tape, the recorder and the sound will stop and the names will be
displayed.
Joan Smith
Patty
~olf
Allison T. Cornpone
Jill Shoe
SallY Ma!tnet
Roxanne o/ShacK
OK
I
The only change required to change from a RAM file to a cassette file was to change
the device specifier to "CAS:" in the OPEN statement in line 500.
Experiment #5 Transfer Data from RAM
to Cassette
Suppose that you have created a data file in RAM and would like to transfer it to
cassette. You might like to do this to make a backup copy or perhaps to allow you to
kill the RAM file to increase available memory.
The following program will allow you to transfer the file "NAMES.DO" that you
created before, to cassette storage:
Clear memory with the NEW command and enter this program from the keyboard.
100 MAXFILES=2 : CLS
110 OPEN "RAM:NAMES" FOR INPUT AS 1
120 OPEN "CAS:NAMES" FOR OUTPUT AS 2
130 INPUT #1 ,N$:PRINT #2,N$:PRINT N$
140 IF NOT EoF(I) GoTo 130
150 CLOSE
127

Advertisement

Table of Contents
loading

Table of Contents