EasyManua.ls Logo

Commodore VIC-20 - Page 258

Commodore VIC-20
404 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...
244 The VIC 20
User
Guide
90
FOR
1=9
TO
123:NEXT
109
FOR
Da128
TO
133
119
POKE
36874,
D
129
NEXT
125
READ
A:
IF
A=~~~
THEN
298
126
POKE
36875,A
139
POKE
36874,9
149
FOR
1-9
TO
300:NEXT
159
GOTO
13
209
POKE
36878,0:RESTORE:GOTO
10
The most important thing to keep in mind when working with this kind
of
program
is
that doing more things within your loops (such as adding more
READ
statements) adds time to the loop. Test statements, such as the one
on line
15,
also take some time.
Be
sure to account for every line.
If
you are
unsure
of
your timing, run the program and listen for timing problems.
By
adding to
or
subtracting from the timing loops, as on lines
50
or
140, you can
usually compensate for timing errors.
The
VIC
Electronic
Organ
Here's a program that "GETs" notes from the keyboard and plays
them. We've used the note values from Table
7-2
and
POKEd them into the
middle and high registers.
300
GET
A':
IF
A
....
""
THEN
399
310
IF
A'-"Q"
THEN
A-195
329
IF
A'-"2"
THEN
A-19~
330
IF
A'="II/"
THEN
A=201
340
IF
A'-"3"
THEN
A=203
350
IF
A'-"E"
THEN
A"'207
360
IF
A'-"R"
THEN
FI-209
370
IF
A'-"5"
THEN
FI=212
380
IF
A'a"T"
THEN
A=215
390
IF
A'="6"
THEN
A=217
490
IF
AS-/lY"
THEN
A-21S1
410
IF
A.*"7"
THEN
A-221
420
IF
A'-"U"
THEN
A-223
430
IF
A''''''I''
THEN
A=225
433
POKE
36875,A:POKE
36876,A
440
FOR
J-13
TO
"
STEP
-.73
430
POKE
36878,J:NEXT
460
Aae:
OOTO
300
This program was written for only one octave.
By
increasing the
number
of
keys read, you can add more octaves.
To
make the keys play

Other manuals for Commodore VIC-20

Related product manuals