EasyManua.ls Logo

Commodore VIC-20 - Page 112

Commodore VIC-20
308 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...
from
1
to
15.
We
suggest
you
always
use
15,
unless
you're playing
with
the
amplitude
as
part
ol
a
sound
effect.
Each
speaker
has
a
range
of
128
separate
settings.
To
"play"
a
particular
note
you
must
POKE
one
of
the
speaker
settings,
which
happen
to
be
numbered
from
128
to
255.
If
you
POKE
a
number
lower
than
128
or
higher
than
255 you
will
get
no
sound
(which
suggests
one
way
to
interrupt
a
speaker
while
it's
"on").
Here's
an
example
of
how
to
play
a
note
on
the
VIC:
20
POKE
36878,15
SETS
VOLUME
AT
MAXIMUM
30
POKE
36875,200
TURNS
ON
SPEAKER
NUMBER
2
40
FOR
X=1TO1000:
THIS
IS
A1000COUNTTIME
DELAY
NEXT
50
POKE
36878,0
THIS
TURNS
THE
SPEAKER
OFF
AFTER
COUNTING TO
1000
RUN
The VIC
uses
the
television
speaker
as
its
"voice,"
so
the
volume
can
also
be
adjusted
by
turning
the
television
speaker
(or
other
external
amplifier).
ABBREVIATING
THE
SOUND
COMMANDS
You
can
abbreviate
the
lengthy
POKE
commands
described
above
by
converting
these
to
programming
"shorthand.1
One
way
is
shown
below:
t0
V-36878:51
=
36874:S2-36875:S3
=
36876:S4
-36877
Now
if
you
want
to
turn
on
a
particular
speaker,
or
set
volume,
you
can use
the
abbreviations
. . .
like,
for
instance:
I
20
POKEV.15
30
POKES2.200
40
FORX
=
1TO1000:NEXT
50
POKEV.O
VICTIP
In
line
10,
we
put
all
the
commands
on
one
line
instead
of
five
lines
because
we
want
to
demonstrate
economical
program
ming
techniques.
You
can
save
memory
and
"crunch"
longer
programs
into
less
space
if
you
put
several
commands
on
a
single
line,
with
each
command
separated
by
a
colon,
as
shown.
96