home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of the Best
/
_.img
/
02154
/
muzak2.arc
/
MUZAK.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-07-09
|
13KB
|
249 lines
1000 ' $MODULE:'OOPS!!!!' $DYNAMIC $LINESIZE:79
1010 ' ****************************************************************
1020 ' ************* MUZAK.BAS By Aaron Ross Priven ************
1030 ' ****************************************************************
1040 ' ************* Version 2.3 9 July 1986 ************
1050 ' ****************************************************************
1060 ' This program is to be in the public domain. All rights waived.
1070 ' May be distributed in any form. You may even take my name off of
1080 ' it and not be legally in any wrong, but you will VERY QUICKLY
1090 ' lose me as a friend!
1100 '
1110 ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1120 ' @ This program is dedicated to Alfred Michael Yankovic, whose @
1130 ' @ heartwarming and inspirational music has helped me to get @
1140 ' @ through the hard times. @
1150 ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1160 '
1170 '
1180 '
1190 ' =Aaron Ross Priven=, 9 July 1986
1200 ' 540 Sylvan Ave., San Mateo, CA 94403-3214
1210 ' Data: (415) 349-2623 sometimes
1220 '
1230 '
1240 ' ******************************* SETUP
1250 DEFINT A-Z ' set all values to integer unless specified
1260 OPTION BASE 1 ' I hate zero subscripts
1270 KEY OFF ' turn soft key display off
1280 IF INSTR(COMMAND$,"-D") OR INSTR(COMMAND$,"/D") THEN DEBUG=-1
1290 ' set DEBUG level fm command line
1300 IF INSTR(COMMAND$,"-F") OR INSTR(COMMAND$,"/F") THEN FAST=-1
1310 ' set FAST level fm command line
1320 LOCATE ,,0,1,13
1330 GOTO 2440 ' goto start of program
1340 '*********************************GET SONG TO PLAY*************
1350 COLOR 15,1,1 ' hiwhite on blue
1360 GOSUB 3240 ' set all colors, cls, and Stars
1370 RESTORE ' restore READ/DATA list to original values
1380 PLAY"MFT120MNO4L4" ' set PLAY values to original values
1390 OPEN DEFINITION.FILE$ FOR INPUT AS #1
1400 ' open the definition file
1410 INPUT#1,LAST.SONG,TOP.PROMPT$
1420 ' number of songs,prompt for top of screen
1430 TOP.PROMPT$="MUZAK v2.3 by Aaron Ross Priven: "+TOP.PROMPT$
1440 COLOR 9,7 ' hiblue on white
1450 PRINT TAB(40-(LEN(TOP.PROMPT$))\2) TOP.PROMPT$ TAB(80)" "
1460 ' print/center top line
1470 COLOR 15,1 ' back to hiwhite on blue
1480 DIM INK$(LAST.SONG),PROMPT$(LAST.SONG),WORDS(LAST.SONG),FILE$(LAST.SONG)
1490 ' dimension keys to press, what to display,
1500 ' whether song has words, filename of song
1510 FOR COUNT=1 TO LAST.SONG' input/count routine
1520 READ INK$(COUNT) ' find the keys to press/input routine
1530 INPUT#1,WORDS(COUNT),FILE$(COUNT),PROMPT$(COUNT)
1540 ' find whether song has words, filename of song,
1550 ' & what to display
1560 NEXT ' end of input routine
1570 GOSUB 2790 ' print prompts (& close definition file)
1580 COLOR 9,7 ' hiblue on white
1590 PRINT TAB(30);"Enter Letter of Music";TAB(80)
1600 ' center above line
1610 COLOR 15,1 ' hiwhite on blue
1620 LOCATE 25,1 ' go to the REALLY last line
1630 COLOR 9,7 ' hiblue on white
1640 PRINT TAB(27);"Escape/Return for Main Menu";TAB(80);
1650 ' center above line
1660 COLOR 15,1 ' hiwhite on blue
1670 TEMP=1 ' flag for the get character subroutine
1680 GOSUB 2960 ' get character &c
1690 '
1700 ' ********************************PRINT TITLE BOX
1710 OPEN FILE$(SONG.NO) FOR INPUT AS #1
1720 ' open music file
1730 COLOR 15,2,2 ' hiwhite on green, border green
1740 GOSUB 3240 ' clear screen, set above colors, stars!
1750 LOCATE 25 ' last line on screen
1760 PRINT "MUZAK v2.3 by Aaron Ross Priven" SPC(29) "Hit <ESC> To Return";
1770 LOCATE 1,2 ' go to positon 2
1780 PRINT CHR$(213)+STRING$(76,205)+CHR$(184)
1790 ' top part of box
1800 LOCATE 5,2 ' top/middle of page
1810 PRINT CHR$(212)+STRING$(76,205)+CHR$(190)
1820 ' bottom part of box
1830 FOR COUNT=1 TO 3 ' print middle part of box & titles
1840 INPUT #1,IKEY$ ' get title string
1850 LOCATE COUNT+1,2 ' get to part of box
1860 PRINT CHR$(179); ' left part of box
1870 LOCATE ,(80-(LEN(IKEY$)))\2
1880 ' number of spaces so that centering is possible
1890 PRINT IKEY$; ' print title string
1900 LOCATE ,79 ' go to way out right
1910 PRINT CHR$(179) ' right part of box
1920 NEXT ' end of printing scrolling boxes
1930 INPUT #1,FILE.LINES
1940 LOCATE 8,1 ' this moves cursor to a couple lines below box
1950 IF WORDS(SONG.NO)=0 THEN 2190 ' if song has words goto 460
1960 '
1970 '********************************************WITHOUT WORDS
1980 DIM FILE.LINE$(FILE.LINES)
1990 ' dimension strings to PLAY
2000 ' +----------------------------------------+
2010 ' | This is done here to avoid the noise |
2020 ' | of whirring disk drives while playing. |
2030 ' +----------------------------------------+
2040 FOR COUNT=1 TO FILE.LINES
2050 ' input strings to play routine
2060 INPUT #1,FILE.LINE$(COUNT)' get the actual string
2070 NEXT ' end of input routine
2080 CLOSE ' close music file
2090 IF NOT DEBUG THEN PLAY "MB" ' set music background
2100 FOR COUNT=1 TO FILE.LINES
2110 ' play music routine (yes, really!)
2120 IF DEBUG THEN PLAY"MF":PRINT FILE.LINE$(COUNT)' debugging routine
2130 PLAY FILE.LINE$(COUNT) ' My God, actually play the music!!!!
2140 IF INKEY$=CHR$(27) THEN 3430 ' end if ESC struck
2150 NEXT ' end playing routine
2160 PLAY"mfp1" ' play music foreground and pause for whole note
2170 ERASE INK$,PROMPT$,FILE$,WORDS,FILE.LINE$ ' kill dimensioned variables
2180 GOTO 1340 ' restart
2190 '******************************************** WITH WORDS
2200 CR$=CHR$(13) ' set carriage return string
2210 FILE.LINES=FILE.LINES*2 ' count is only MUSIC codes
2220 DIM FILE.LINE$(FILE.LINES)
2230 ' dimension strings
2240 FOR COUNT=1 TO FILE.LINES
2250 ' input music/words routine
2260 INPUT #1,FILE.LINE$(COUNT)
2270 ' input strings
2280 IF RIGHT$(FILE.LINE$(COUNT),1)<>"|" THEN 2310
2290 FILE.LINE$(COUNT)=LEFT$(FILE.LINE$(COUNT),LEN(FILE.LINE$(COUNT))-1)+CR$
2300 ' if last character is | then change to CR
2310 NEXT ' end input routine
2320 CLOSE ' close file
2330 FOR COUNT=2 TO FILE.LINES STEP 2
2340 ' play / print words routine
2350 PRINT FILE.LINE$(COUNT-1);' print the words
2360 IF DEBUG THEN PRINT FILE.LINE$(COUNT) ' Debug routine
2370 PLAY "MF"+FILE.LINE$(COUNT)' play music + getting rid of 'MB's
2380 IF INKEY$=CHR$(27) THEN 3430 ' end if ESC struck
2390 NEXT ' end playing routine
2400 PLAY"mfp1" ' quit playing and pause for a whole note
2410 '
2420 ERASE INK$,PROMPT$,FILE$,WORDS,FILE.LINE$ ' kill dimensioned variables
2430 GOTO 1340 ' restart
2440 '*******************************************SELECT BATCH OF SONGS
2450 RANDOMIZE TIMER
2460 RESTORE ' restore data for INK$
2470 COLOR 0,6,6 ' black on amber
2480 GOSUB 3240 ' clear screen, set above colors active
2490 COLOR 6,0 ' amber on black
2500 PRINT TAB(12);"MUZAK v2.3 by Aaron Ross Priven: Which Group of Songs";TAB(80)" "
2510 ' print the title line
2520 COLOR 0,6 ' black on amber
2530 OPEN "DEFINTN.MUZ" FOR INPUT AS #1
2540 ' open the master definition file
2550 INPUT#1,LAST.SONG ' input the number of sets of songs
2560 DIM INK$(LAST.SONG),PROMPT$(LAST.SONG),FILE$(LAST.SONG)
2570 ' dimension keys-to-press,prompt for each set,
2580 ' filename of set
2590 FOR COUNT=1 TO LAST.SONG' input / get keys-to-press routine
2600 READ INK$(COUNT) ' get key to press
2610 INPUT#1,FILE$(COUNT),PROMPT$(COUNT)
2620 ' get filename and what to display for set
2630 NEXT ' end input/keys-to-press routine
2640 GOSUB 2790 ' print prompts (& close definition file)
2650 COLOR 6,0 ' amber on black
2660 PRINT TAB(29);"Escape Key - End Program";TAB(80)
2670 ' print escape-to-end message
2680 COLOR 0,6 ' black on amber
2690 LOCATE 25,1 ' goto last line
2700 COLOR 6,0 ' amber on black
2710 PRINT TAB(30);"Enter Letter of Music";TAB(80);
2720 COLOR 0,6 ' black on amber
2730 TEMP=0 ' flag for next subroutine
2740 GOSUB 2960 ' get character
2750 DEFINITION.FILE$=FILE$(SONG.NO)
2760 ' save the filename
2770 ERASE INK$,PROMPT$,FILE$
2780 GOTO 1340
2790 '************************PRINT PROMPTS ROUTINE
2800 CLOSE#1 ' close input file
2810 FOR COUNT=1 TO LAST.SONG-1 STEP 2
2820 ' print prompt routine
2830 LOCATE COUNT\2+2,1 ' line to print prompt on
2840 PRINT INK$(COUNT);" - ";PROMPT$(COUNT);
2850 ' print key to press, name of song (left side)
2860 LOCATE ,40 ' shift position to right side
2870 PRINT INK$(COUNT+1);" - ";PROMPT$(COUNT+1)
2880 ' print key to press, name of song (right side)
2890 NEXT ' end of print songs routine
2900 IF LAST.SONG\2=LAST.SONG/2 THEN 2940
2910 ' if # of songs is odd then -->
2920 PRINT INK$(LAST.SONG);" - ";PROMPT$(LAST.SONG)
2930 ' print last song
2940 LOCATE 24,1 ' go to second to last line
2950 RETURN
2960 '**************************GET KEY FOR MENU
2970 IKEY$ = INPUT$(1) ' one character
2980 IF NOT(TEMP=1 AND (IKEY$=CHR$(13) OR IKEY$=CHR$(27))) THEN 3010
2990 ERASE INK$,PROMPT$,FILE$,WORDS ' kill dimensioned variables
3000 RETURN 2440 ' if key is ESC/CR, go to 'pick a set' menu
3010 IF TEMP=0 AND IKEY$=CHR$(27) THEN 3150
3020 ' if from main menu, key is ESC, then quit
3030 FLAG=0 ' set flag for the following routine
3040 IF IKEY$<="z" AND IKEY$>="a" THEN IKEY$=CHR$(ASC(IKEY$)-32)
3050 ' make lowercase capitals
3060 FOR A=1 TO LAST.SONG ' identify song input routine
3070 IF IKEY$=INK$(A) THEN SONG.NO=A:FLAG=1
3080 ' if the key input is this key then save
3090 NEXT ' end identify song-input routine
3100 IF FLAG=0 THEN 2960 ' if the key is not there then go get another
3110 RETURN
3120 '**************************DATA FOR INK$
3130 DATA A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
3140 DATA 1,2,3,4,5,6,7,8,9,0,+,-,*,/
3150 '****************************QUIT
3160 LOCATE 24,1:PRINT SPC(79);:LOCATE 24,1
3170 PRINT "Are you Really Absolutely Sure?";' are you REALLY sure?
3180 LOCATE 25,1:PRINT SPC(79);:LOCATE 25,1,1' I don't want people
3190 PRINT"(Hit <Y> to exit, any other key to return)";' leaving MUZAK
3200 I$=INPUT$(1):IF I$><"y" AND I$><"Y" THEN LOCATE ,,0:RUN' accidentally.
3210 CLOSE ' just to be sure
3220 CLS
3230 SYSTEM
3240 '************************<< GALAXY >>********************
3250 CLS:IF FAST THEN RETURN
3260 A.GAL$="*":B.GAL$=".":C.GAL$="+":D.GAL$="*"
3270 ' set up star characters
3280 FOR I.GAL=1 TO 25 ' # of star lines to print
3290 A.GAL=INT(RND(1)*28) : B.GAL=INT(RND(1)*25)+28 : C.GAL=INT(RND(1)*25)+55
3300 LOCATE I.GAL,1 ' both above & this: set up where to print it
3310 X.GAL!=RND(1) ' random floating point number
3320 IF X.GAL!<.15 THEN SWAP A.GAL$,B.GAL$ : GOTO 3390
3330 IF X.GAL!<.3 THEN SWAP B.GAL$,C.GAL$ : GOTO 3390
3340 IF X.GAL!<.45 THEN SWAP A.GAL$,C.GAL$ : GOTO 3390
3350 IF X.GAL!<.6 THEN SWAP A.GAL$,D.GAL$ : GOTO 3390
3360 IF X.GAL!<.75 THEN SWAP B.GAL$,D.GAL$ : GOTO 3390
3370 IF X.GAL!<.9 THEN SWAP C.GAL$,D.GAL$
3380 ' all those decide which char goes first
3390 PRINT TAB(A.GAL);A.GAL$;TAB(B.GAL);B.GAL$;TAB(C.GAL);C.GAL$;' print lines
3400 NEXT ' we shall return...
3410 LOCATE 1,1
3420 RETURN
3430 ' *********************************ESC TRAPPING
3440 ERASE INK$,PROMPT$,FILE$,WORDS,FILE.LINE$ ' kill dimensioned variables
3450 PLAY "MF" ' wait for music to be over if necessary
3460 GOTO 1340 ' restart
oned variables
3450 PLAY "MF" ' wait for music to be