[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

When you've had a little more practice with making music, then you can get a little more involved, by using the PEEK function. PEEK is a function that is equal to the value currently in the indicated memory location.


   X=PEEK(MEM)

The value of the variable X is set equal to the current contents of memory location MEM.

Of course, your programs include other BASIC commands, but for a full explanation of them, refer to the BASIC Statements section of this manual.

Let's jump right in and try a simple program using only one of the three voices. Computer ready? Type NEW, then type in this program, and save it on your Commodore DATASSETTETM or disk. Then, RUN it.

EXAMPLE PROGRAM 1:

 5 S=54272
 10 FORL=STOS+24:POKEL,0:NEXT:REM CLEAR SOUND CHIP
 20 POKES+5,9:POKES+6,0
 30 POKES+24,15              :REM SET VOLUME TO MAXIMUM
 40 READHF,LF,DR
 50 IFHF<0THENEND
 60 POKES+1,HF:POKES,LF
 70 POKES+4,33
 80 FORT=1TODR:NEXT
 90 POKES+4,32:FORT=1TO50:NEXT
 100 GOTO40
 110 DATA25,177,250,28,214,250
 120 DATA25,177,250,25,177,250
 130 DATA25,177,125,28,214,125
 140 DATA32,94,750,25,177,250
 150 DATA28,214,250,19,63,250
 160 DATA19,63,250,19,63,250
 170 DATA21,154,63,24,63,63
 180 DATA25,177,250,24,63,125
 190 DATA19,63,250,-1,-1,-1

Here's a line-by-line description of the program you've just typed in. Refer to it whenever you feel the need to investigate parts of the program that you don't understand completely.


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated February 10, 2002.