Menu, drawing program, and music program.
Source Code
1 REM Menu 2 CLS 3 PAPER 0 4 INK 7 5 BORDER 1 10 PRINT " Creative Graphics and Music" 20 PRINT 30 PRINT " by M. Zerbo" 40 PRINT "________________________________" 50 PRINT 60 PRINT "Menu:" 70 PRINT 80 PRINT "(1) To load Creative Graphics" 85 PRINT 90 PRINT "(2) To load Creative Music" 95 PRINT 96 PRINT "(3) To terminate program" 97 PRINT 98 PRINT 99 PRINT "Enter choice:"; 100 IF INKEY$="1" THEN PRINT 1: PRINT : PRINT : PRINT "Position tape & press a key.": PAUSE .1: LOAD "GRAPHICS" 101 IF INKEY$="2" THEN PRINT 2: PRINT : PRINT : PRINT "Position tape & press a key.": PAUSE .1: LOAD "MUSIC" 102 IF INKEY$="3" THEN PRINT 3: PRINT : PRINT : PRINT "Goodbye": PAUSE 65: STOP 105 GO TO 100 1 REM Creative Graphics 2 REM Written by M. Zerbo 5 REM RESET 1987 by M. Zerbo 8 INVERSE 0: FLASH 0: BRIGHT 0: PAPER 0: INK 7: BORDER 1 9 CLS 10 LET x=0: LET y=0 11 LET c=0 20 PRINT " CREATIVE GRAPHICS" 30 PRINT 40 PRINT " Written by M. Zerbo" 50 PRINT 55 PRINT " [ ] " 56 PRINT " 0 1 2 3 4 5 6 7" 60 PRINT : PRINT 70 PRINT "ENTER BACKGROUND COLOR (0-7): "; 80 INPUT b 85 IF b<0 OR b>8 THEN GO TO 80 90 PRINT b: PRINT : PRINT 95 PRINT "ENTER BORDER COLOR (0-7): "; 96 INPUT bo 97 IF bo<0 OR bo>8 THEN GO TO 96 98 PRINT bo: PRINT : PRINT 100 PRINT "ENTER INK COLOR (0-7): "; 110 INPUT i 120 IF i<0 OR i>8 THEN GO TO 110 130 PRINT i 140 PAPER b: INK i: BORDER bo 150 CLS 160 PLOT x,y 165 IF |(2,1)=1 THEN OVER 1: PLOT x,y: OVER 0 170 LET c=CODE INKEY$ 180 LET s=|(1,1) 181 IF c=113 THEN GO SUB 600 182 IF c=116 THEN GO SUB 550 183 IF c=110 THEN GO SUB 520 184 IF c=115 THEN GO SUB 500 185 IF c=108 THEN GO SUB 220 186 IF c=100 THEN GO SUB 300 187 IF c=99 THEN GO SUB 330 188 IF c=114 THEN GO SUB 410 189 IF c=112 THEN GO SUB 450 190 LET x=x+(s=8)+(s=9)+(s=10)-(s=4)-(s=5)-(s=6) 195 LET y=y+(s=1)+(s=9)+(s=5)-(s=2)-(s=10)-(s=6) 196 IF x<0 THEN LET x=0 197 IF x>255 THEN LET x=255 198 IF y<0 THEN LET y=0 199 IF y>175 THEN LET y=175 200 IF c>=48 AND c<=56 THEN INK (c-48) 202 IF c=105 THEN INVERSE 1 203 IF c=172 THEN INVERSE 0 204 IF c=101 THEN GO SUB 400 205 IF c=32 THEN GO SUB 630 210 GO TO 160 220 LET x1=x/8: LET y1=21-(y/8) 230 PRINT AT y1,x1;" " 232 IF |(2,1)=1 THEN OVER 1: PRINT AT y1,x1;" ": OVER 0 233 LET c=CODE INKEY$ 234 LET s=|(1,1) 235 IF c=98 THEN BRIGHT 1 236 IF c=42 THEN BRIGHT 0 237 IF c=102 THEN FLASH 1 238 IF c=204 THEN FLASH 0 239 IF c=101 THEN GO SUB 400 240 LET x1=x1+(s=8)+(s=9)+(s=10)-(s=4)-(s=5)-(s=6) 250 LET y1=y1-(s=1)-(s=9)-(s=5)+(s=2)+(s=10)+(s=6) 251 IF c>=48 AND c<=56 THEN INK (c-48) 252 IF x1<0 THEN LET x1=0 253 IF x1>31 THEN LET x1=31 254 IF y1<0 THEN LET y1=0 255 IF y1>21 THEN LET y1=21 256 IF c=104 THEN LET x=x1*8: LET y=175-(y1*8): RETURN 257 IF c=114 THEN GO SUB 410 258 IF c=113 THEN GO SUB 600 259 IF c=116 THEN GO SUB 550 260 IF c=110 THEN GO SUB 520 261 IF c=32 THEN GO SUB 630 262 IF c=115 THEN GO SUB 500 263 GO TO 230 300 REM Draw line 305 INPUT "Enter horizontal distance: ";z 306 IF z>255 THEN GO TO 305 310 INPUT "Enter vertical: ";q 311 IF q>175 THEN GO TO 310 312 ON ERR GO TO 316 313 INPUT "Enter angle: ";a 314 LET x=(z+x): LET y=(q+y) 315 DRAW z,q,a 316 ON ERR RESET 320 RETURN 330 REM Circle 332 ON ERR GO TO 355 335 INPUT "Enter radius: ";r 340 IF r<0 THEN GO TO 335 350 CIRCLE x,y,r 355 ON ERR RESET 360 RETURN 400 REM Erase 405 INPUT "Are you sure? (y/n) ";a$ 406 IF a$="y" THEN CLS : LET x=0: LET y=0: RETURN 407 IF a$="n" THEN RETURN 408 GO TO 405 410 REM Re-start 420 GO SUB 405 425 IF a$="y" THEN RUN 430 RETURN 450 REM Position 452 ON ERR GO TO 472 455 INPUT "Enter horizontal distance: ";z 456 IF z>255 THEN GO TO 455 459 INPUT "Enter vertical distance: ";q 460 IF q>175 THEN GO TO 459 470 LET x=x+z: LET y=y+q: PLOT x,y 472 ON ERR RESET 480 RETURN 500 REM Save screen 510 SAVE "Picture"SCREEN$ 515 RETURN 520 REM New screen 530 LOAD ""SCREEN$ 540 RETURN 550 REM Text 560 INPUT "Enter horizontal position: ";p 565 IF p<0 OR p>31 THEN GO TO 560 570 INPUT "Enter vertical position: ";v 575 IF v<0 OR v>21 THEN GO TO 570 580 INPUT "Enter text: ";t$ 585 PRINT AT v,p;t$ 590 RETURN 600 REM End program 610 INPUT "Are you sure? (y/n) ";q$ 615 IF q$="y" THEN PRINT "Goodbye...": STOP 616 IF q$="n" THEN RETURN 620 GO TO 610 630 REM Hardcopy 640 COPY 650 RETURN 1 REM MUSIC 2 REM \* 1985 by M. Zerbo 4 FOR f=0 TO 7: READ l: POKE USR "q"+f,l: NEXT f 5 DATA BIN 11111111 6 DATA BIN 00111100 7 DATA BIN 00011000 8 DATA BIN 00011000 9 DATA BIN 00011000 10 DATA BIN 00011000 11 DATA BIN 00011000 12 DATA BIN 00011000 13 GO SUB 9990: GO TO 9000 15 PRINT TAB 7;"\ .\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\. " 20 PRINT TAB 7;"\ :MUSICAL GLASSES\: " 22 PRINT TAB 7;"\ '\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\' " 23 FOR f=19 TO 21: PRINT AT f,0;" " 24 NEXT f: PRINT AT 0,0; 32 LET a=23: LET b=95: PRINT 50 PRINT 53 OVER 1: PRINT AT 10,2;"\''\''\::\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\::\''\''" 54 FOR f=11 TO 20: PRINT AT f,4;" ";AT f,24;" " 55 NEXT f: PAUSE 10: FOR f=1 TO 12 56 PAUSE 8: BEEP .005,1 60 PLOT a,b 70 DRAW 9,0 80 DRAW 0,17: DRAW -9,0: DRAW 0,-17 90 LET a=a+16 92 NEXT f 93 PAUSE 20 95 LET l=0 100 LET x=110: LET a=24 102 FOR y=1 TO 12: PRINT AT 5,a/8-3;"\q": PRINT AT 6,a/8-3;"\''\''\''\::": PRINT AT 7,a/8; OVER 1;"\q": OVER 0: LET x=x-1: PAUSE 10: FOR f=96 TO x: INK 1 105 SOUND 6,2;7,55;8,12 106 PLOT a,f: DRAW 7,0: NEXT f: SOUND 8,0 107 PRINT AT 5,a/8-3;" ";AT 6,a/8-3;" ": PRINT AT 7,a/8; INK 7;"_": LET a=a+16 108 NEXT y 110 INK 7 111 PRINT AT 6,3;"C C#D D#E F F#G G#A A#B" 112 OVER 0 140 DIM f(52): RESTORE 342: FOR i=1 TO 12: READ a,b: LET f(a)=b: NEXT i 150 RESTORE 302: FOR u=65268 TO 65276: READ o: POKE u,o: NEXT u 152 READ o,o1,o2: RESTORE 310: READ l,k,h: POKE l,o: POKE k,o1: POKE h,o2 200 INK 7 202 IF qwe=2 THEN GO TO 500 204 IF INKEY$="m" OR INKEY$="M" THEN GO TO 9000 205 LET o=65219+CODE INKEY$ 206 IF PEEK O=0 THEN GO TO 203 207 PLOT INK 0;A,138: LET A=f(PEEK o): PLOT A,138 210 SOUND 0,PEEK o;1,0;7,62;8,16;12,15;13,0 212 PAUSE 0: GO TO 203 300 DATA 26,24,23,21,20,19,18,17,16,15,14,13 302 DATA 52,48,46,43,41,39,36,34,32,31,29,27 310 DATA 65267,65335,65340 342 DATA 52,28,48,44,46,60,43,76,41,92,39,108,36,124,34,140,32,156,31,172,29,188,27,204 500 PRINT AT 11,9;"COMPOSITION" 502 INPUT "Input # of notes: ";n1 503 IF n1<1 THEN GO TO 502 504 INPUT "Input tone: ";t: IF t<1 OR t>2 THEN GO TO 504 505 DIM n(n1,2): LET n2=n1: LET n1=1 506 PRINT AT 13,7;"NOTE #:";n1 507 INPUT "Input note code: ";o$: IF o$="m" OR o$="M" THEN GO TO 9000 508 IF o$="PLAY" OR o$="play" THEN GO TO 530 509 LET o=65219+CODE o$: INPUT "- note length: ",l 510 IF l<.5 THEN GO TO 509 520 IF PEEK o=0 THEN FOR j=0 TO l: PAUSE 5:: NEXT j: GO TO 527 521 FOR f=0 TO l 522 PLOT INK 0;A,138: LET A=f(PEEK o): PLOT A,138 524 SOUND 0,PEEK o;1,0;7,62;8,16;12,15;13,0 525 IF t=2 THEN SOUND 8,0 526 NEXT f 527 LET n(n1,1)=o: LET n(n1,2)=l: LET n1=n1+1 528 IF n1>n2 THEN LET n1=n1-1 529 GO TO 506 530 INPUT "Repetition rate: ";r: FOR z=1 TO r: FOR f=1 TO n1 531 PRINT AT 13,14;" ": PRINT AT 13,7;"NOTE #:";f 532 IF PEEK n(f,1)=0 THEN FOR j=0 TO n(f,2): PAUSE 5:: NEXT j: NEXT f: IF f>n1 THEN GO TO 539 535 FOR d=1 TO n(f,2): PLOT INK 0;A,138: LET A=f(PEEK n(f,1)): PLOT A,138 536 SOUND 0,PEEK (n(f,1));1,0;7,62;8,16;12,15;13,0 537 IF t=2 THEN SOUND 8,0 538 NEXT d: NEXT f 539 NEXT z 540 INPUT "Do you wish to clear? ";y$ 542 IF y$(1)="y" THEN GO TO 545 543 IF y$(1)="n" THEN GO TO 506 544 GO TO 540 545 PAUSE 5: PRINT AT 13,14;"0 ": GO TO 500 8999 STOP 9000 OVER 0: PAPER 0: CLS : BORDER 2: INK 7: PRINT TAB 9;"CREATIVE MUSIC" 9002 PRINT 9005 PRINT : PRINT " Menu:" 9006 PRINT : PRINT "(1) Musical Glasses" 9007 PRINT "(2) Musical Glasses(composition)" 9008 PRINT "(3) Music Composer" 9009 PRINT "(4) Program Instructions" 9010 PRINT "(5) Terminate Program" 9012 INPUT "Input choice: ";qwe 9013 IF qwe<1 OR qwe>5 THEN GO TO 9012 9015 PRINT AT 4+qwe,0;"(";qwe;")" 9016 PAUSE 10 9017 CLS 9018 GO TO (qwe=1 OR qwe=2)*14+(qwe=3)*9019+(qwe=4)*9600+(qwe=5)*9900 9020 PRINT TAB 8;"MUSIC COMPOSER" 9021 LET o=5 9022 PRINT : PRINT "NOTE": PRINT 9023 PRINT " C": PRINT " C#": PRINT " D": PRINT " D#": PRINT " E": PRINT " F": PRINT " F#": PRINT " G": PRINT " G#": PRINT " A": PRINT " A#": PRINT " B": PRINT " -" 9024 LET r=1: PRINT AT 8,10;"OCTIVE:";O;AT 10,10;"Note #:";r: LET it=4: PRINT AT it,3;"<" 9025 INPUT "Input # of notes: ";i: IF i<1 THEN GO TO 9025 9026 DIM d(i,2): PRINT AT 3,12;"COMPOSITION MODE" 9027 LET ut=it: LET it=it-(INKEY$="7")+(INKEY$="6")+(|(1,1)=2)-(|(1,1)=1) 9028 IF ut=it THEN GO TO 9034 9029 IF it<4 THEN LET it=4 9030 IF it>16 THEN LET it=16 9031 PRINT AT ut,3;" " 9032 PRINT AT it,3;"<" 9034 PRINT AT 8,10;"OCTIVE:";o;AT 10,10;"Note #:";r 9050 IF INKEY$="0" OR |(2,1)=1 THEN BEEP .005,21: GO SUB 9080 9051 IF INKEY$="o" THEN GO TO 9200 9052 IF INKEY$="m" THEN GO TO 9000 9053 IF INKEY$="p" THEN GO TO 9400 9055 IF INKEY$="c" THEN GO SUB 9299 9057 GO TO 9027 9081 INPUT "Input length of note: ";ls 9082 IF ls<=0 OR ls>10 THEN GO TO 9081 9090 LET d(r,1)=ls*.1 9091 IF it=16 AND ls>=1 THEN LET d(r,2)=100: PAUSE ls*ls*ls: BEEP .005,1: GO TO 9096 9092 IF it=16 AND ls<1 THEN LET d(r,1)=1: RETURN 9093 LET d(r,2)=it-64+(o*12) 9094 IF d(r,2)>69 THEN LET d(r,2)=69 9095 BEEP ls*.1,d(r,2) 9096 LET r=r+1 9097 IF r>i THEN LET r=i 9098 RETURN 9200 PRINT AT 8,10;"OCTIVE:";o 9202 INPUT "Input octive: ";o 9203 IF o<0 OR o>10 THEN GO TO 9202 9205 GO TO 9027 9300 INPUT "Input note #: ";rt 9303 IF rt<1 OR rt>i THEN GO TO 9300 9305 LET r=rt: RETURN 9400 PRINT AT 10,17;"- ": PRINT AT 3,12;" PLAY MODE ": INPUT "Repetition rate: ";x 9401 IF x<1 THEN GO TO 9400 9402 FOR z=1 TO x: FOR f=1 TO r 9405 IF d(f,2)=100 THEN PAUSE d(f,1)*d(f,1)*d(f,1): NEXT f: IF f>r THEN GO TO 9450 9410 BEEP d(f,1),d(f,2): NEXT f 9450 NEXT z 9452 INPUT "Do you wish to clear? ";y$ 9455 IF y$(1)="n" THEN PRINT AT 3,12;"COMPOSITION MODE": GO TO 9027 9456 IF y$(1)="y" THEN GO TO 9000 9460 GO TO 9452 9600 BORDER 0: CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9602 PRINT : PRINT "This program allows the user to create music and also learn moreabout it. There are 5 options " 9605 PRINT "available. The first one deals with playing a set of glasses filled with water. The sound made is almost the same as in real life. The program begins with the glasses being placed on" 9610 PRINT "a table. A water faucet then fills each glass up and you are ready yo play. The note of each glass appears directly above it." 9620 PRINT "By pressing the keys 1,2,3,4,5,67,8,9,0,t,y the notes they represent will be sounded. By holding down one of these keys the sound made will be constant." 9630 PRINT : PRINT " Press any key to continue" 9632 PAUSE 0: BEEP .005,31 9633 CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9650 PRINT : PRINT "If you wish to return to the menu, the pressing of ""m"" will allow the return." 9652 PRINT : PRINT "The second option available is similiar to the 1st one except this one allows the composing ofmusic." 9700 PRINT "After the glasses are set up theprogram will ask several questions. The first one requires the number of notes youwish to compose. The second question deals with the tone of the notes. By inputting a 1 the tone will be normal, but entering a 2 will give a type of""choppy"" sound to the notes." 9704 PRINT : PRINT " Press any key to continue" 9705 PAUSE 0: BEEP .005,31: CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9710 PRINT : PRINT "From then on by entering the keys 1,2,3... as you did before in option #1 ,in response to theprompt asking for the note code,will store in memory that note. By entering ""play"" in place of a note will play all the notes stored in memory. By entering a ""m"" it will allow you to return to the menu." 9720 PRINT "By entering any thing other thanthe keys assigned as notes or (m,play) it will allow you to enter a rest." 9725 PRINT "After entering the note code a prompt will ask for the note length. The best way to determine the proper lengths is by practice." 9730 PRINT " Press any key to continue" 9732 PAUSE 0: BEEP .005,31: CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9740 PRINT : PRINT "When you are ready to play your composition & enter the ""play"" " 9742 PRINT "command the computer will ask the repetition rate. This rate is the number of times you wish to have your song repeated. " 9750 PRINT "After your song is played the computer will ask if you want toclear. If you answer no the song in memory will not be erased. By answering yes it willallow you to start over with no music in memory." 9752 PRINT : PRINT "The third option allows the userto compose music in a standard tone with over ten octaves to work with." 9755 PRINT : PRINT " Press any key to continue" 9756 PAUSE 0: BEEP .005,31: CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9758 PRINT : PRINT "The notes are selected either by the keyboard or a joystick. The notes are lined up at the left-hand side of the screen andcan be chosen when you position a marker directly in front of the note you want. If you use the keyboard the arrow keys 6&7" 9760 PRINT "will move the marker up and down. Pressing the ""0"" key will put that mote in memory. When" 9762 PRINT "using a joystick the fire buttonis used to enter a note. The last symbol of the notes represents a rest. Pressing the ""o"" key allows the user to " 9765 PRINT "change octaves. The user can enter a number from 0 to 10 for an octave." 9766 PRINT " Press any key to continue" 9767 PAUSE 0: BEEP .005,31: CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9770 PRINT : PRINT "Pressing the ""m"" key will returnthe user to the menu and pressing ""p"" will play out the" 9772 PRINT "composition. Pressing the ""c""" 9775 PRINT "key will allow changes in your composition. By entering the note you wish to change it will allow you to start over at that position. Movement throughout your composition is possible with this method." 9780 PRINT : PRINT "The 4th option in this program is the instructions you are reading now. The 5th option endsthe program. Entering ""RUN"" will" 9782 PRINT "begin the program again." 9783 PRINT : PRINT " Press any key to continue" 9784 PAUSE 0: BEEP .005,31: CLS : PRINT TAB 6;"PROGRAM INSTRUCTIONS" 9785 PRINT : PRINT "All of the options in this program are available through a menu which is easily accessible at any point in the program." 9790 PRINT : PRINT "CREATIVE MUSIC can be used for education, entertainment, and asa programming utility." 9795 PRINT : PRINT : PRINT " Press any key to continue" 9796 PAUSE 0: BEEP .01,1: CLS 9800 GO TO 9000 9900 PRINT : PRINT "Goodbye...": STOP 9990 PAPER 0: BORDER 1: INK 4: CLS 9991 PRINT : PRINT " C R E A T I V E M U S I C" 9992 FOR f=1 TO 2 9993 FOR d=0 TO 9 9994 BEEP .05,d*f: INK d: CIRCLE 127,85,(5+f)*d 9995 NEXT d: NEXT f 9996 PRINT AT 20,0;" \* 1985 by M. Zerbo" 9997 PRINT " PRESS ANY KEY TO BEGIN" 9998 PAUSE 0: RETURN