EasyManua.ls Logo

Commodore 64 - Advanced Cassette Operation

Commodore 64
176 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...
APPENDIX B
ADVANCED CASSETTE OPERATION
Besides saving copies of your programs on tape, the Commodore 64
can also store the values of variables and other items of data, in a
group called a FilE. This allows you to store even more information than
could be held in the computer's main memory at one time.
Statements used with data files are OPEN, CLOSE, PRINT#, INPUT#,
and GET#. The system variable ST (status) is used to check for tape
markers.
In writing data to tape, the same concepts are used as when display-
ing information on the computer's screen. But instead of PRINTing in-
formation on the screen, the information is PRINTed on tape using a
variation of the PRINT command-PRINT#.
The following program illustrates how this works:
10 PRINT "WRITE-TO-TAPE-PROGRAM"
20 OPEN 1,1,1,"DATA FILE"
30 PRINT "TYPE DATA TO BE STORED OR TYPE STOP"
50 PRINT
60 INPUT "DATA",A$
70 PRINT #1, A$
S0 IF A$ <:>"STOP" THEN 50
90 PRINT
100 PRINT "CLOSING FILE"
110 CLOSE 1
The first thing that you must do is OPEN a file (in this case DATA FilE).
Line 10 handles that.
The program prompts for the data you want to save on tape in line
60. Line 70 writes what
you typed-held in A$-onto the tape. And the
process continues.
If you type STOP, line 110 CLOSES the file.
110

Table of Contents

Other manuals for Commodore 64

Related product manuals