Commodore VIC-20 User Manual page 86

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

c
Line 100 contains a REMark which explains what this section
is supposed to do. It's called a "loop" because the section
will read and play one note, then "loop" back to the
(
beginning and do it again for another note. Line 110 turns ud
the volume.
(
Now we'll tell the VIC to find out what note to play:
V1CTIP:
Programs don't have to start with line #1, or be
numbered by 1. Most programs start at 10 and go up in
increments of 10. This way you can go back and add
extra lines in between if you want. For example you
could add a line 11, 12, etc. between lines 10 and 20
Line 120 tells the VIC to look through the program and READ
C
information — call it P — about what note to play. This
information is contained in a "mystery statement" that we
haven't written yet. Similarly, line 140 tells the VIC to READ
information — call it D — about the duration of the note.
Notice especially line 130. The function of this line is to stop
the program when the last note has been read. Without some
kind of "end of melody" marker, the program would try to read
notes that haven't been written, and make an error Line 130
says that when the VIC reads this marker, a value of -1 it
should not try to play this note, but go to an ending module at
line 200. We must remember to place -1 at the end of our
"mystery statement."
Now we'll have the VIC actually play the note, cut it off, and qo
back for another:
c
<
c
c
76
(
(
/

Advertisement

Table of Contents
loading

Table of Contents