Chapter
7:
Sound 243
Programming
Rhythm
Programming rhythm on the VIC
is
much like programming the train
sound
we
made earlier. Let's start with a simple drum sound.
10
POKE
36878,15
20
POKE
36877,
229
30
FOR
1=0
TO
25:NEXT
40
POKE
36877,0
50
FOR
1=0
TO
250:NEXT
60
POKE
36877,229
70
FOR
1~0
TO
25:NEXT
80
POKE
36877,0
90
FOR
1=0
TO
250:NEXT
100
POKE
36877,129
110
FOR
1=0
TO
125:NEXT
120
POKE
36877,O
130
FOR
1=0
TO
650:NEXT
140
OOTO
20
By
using the low tone register as follows
we
can add a bass drum:
100
FOR
D=128
TO
133
110
POKE
36874,D
120
NEXT
130
POKE
36874,0
Changing the loop variables will vary the speed of the rhythm.
50
FOR
1=0
TO
125:NEXT
90
FOR
1=0
TO
125:NEXT
140
FOR
1-0
TO
650:NEXT
By
adding some
READ
statements to the rhythm program
we
can
include a melody. Here's the complete listing.
1
DATA
0,0,0,0,0,0,237,239,240
2
DATA
240,239,239,237,237,237,239,240
3
DATA
243,239,240,237,237,999
10
POKE
36878,15
15
READ
A:IF
A-999
THEN
200
16
POKE
3687!5,A
20
POKE
36877,229
30
FOR
1-0
TO
25:NEXT
40
POKE
36877,0
50
FOR
1=0
TO
123:NEXT
60
POKE
36877,229
70
FOR
1=0
TO
23:NEXT
80
POKE
36877,O