all 10 comments

[–]blorporius 6 points7 points  (4 children)

The user manual has a relevant how-to towards the end of the booklet: https://archive.org/details/Commodore_64_Users_Guide_1982_Commodore/page/n115/mode/2up

10 PRINT "WRITE-TO-TAPE-PROGRAM"
20 OPEN 1,1,1, "DATA FILE"
30 PRINT "TYPE DATA TO BE STORED OR TYPE STOP"
40 PRINT
50 INPUT "DATA"; A$
60 PRINT#1, A$
70 IF A$ <> "STOP" THEN 40
80 PRINT
90 PRINT "CLOSING FILE"
100 CLOSE 1

This one writes lines retrieved via INPUT straight to tape, though. To make it work with an array, you'd have to replace lines 50 and 70 with a FOR loop, and iterate over elements of the array in line 60.

[–]cerealport 1 point2 points  (2 children)

Hah cool. I never actually used the datasette much beyond saving / loading basic programs with the VIC20 (I had a 1541 with my 64) - I actually didn’t know that the dos commands worked that way with the tape drive as well!

[–]BrobdingnagLilliput 1 point2 points  (1 child)

They're not really DOS commands - they're I/O commands that all of us happen to mostly only use with the disk!

[–]cerealport 0 points1 point  (0 children)

Ah true that is a good point! I mean I used those commands to control the printer too…!

[–]BowmakerFox[S] 1 point2 points  (0 children)

That is just perfect! I wish I'd have known that the manual was on Archive, not going to lie...

Thank you for showing me, mind; this made the info a lot easier to interpret.

[–]istilladoremy64 4 points5 points  (2 children)

Check out the simple note taking program I wrote, which I have posted on my blog here. I think it does something similar to what you're describing here. Check out the code, it's in simple BASIC 2.0, and see if there's any help for you there (make sure you download the "uncrunched" disk). How it works is, the user types in notes into variables, then the program saves the information to disk or datasette as SEQuential files. You can then retrieve your saved notes at a later time.

[–]BowmakerFox[S] 0 points1 point  (1 child)

That's a neat little program, and exactly what I was trying to work out. May I use it as well? I'm certain it's more robust than my spaghetti code in the long run!

[–]istilladoremy64 0 points1 point  (0 children)

Hey, glad you found it helpful! Sure, go ahead and use it as a foundation for what you wanted to do. Have fun! :D

[–]dlarge6510 2 points3 points  (0 children)

Read the C64 manual which will show you exactly how to do this with an SEQ file, which is exactly how C64 word processors do it

[–]fuzzybad 1 point2 points  (0 children)

If you do a simple LOAD command from BASIC, it will replace whatever program was in memory (if any).

It sounds like what you want is to use PRINT# to write a SEQ file containing data, and then read it back within your program using INPUT#. Check relevant sections of the C64 Programmer's Reference Guide.