//song.c void PlayNote(void); char note, musicT;//plating notes and its counter char audioT; unsigned char MusicTime, temp; unsigned char length[3]={183,163,237}; // Songs' length unsigned char patsize[3]={60,60,60}; //Songs array note and its length //Butterfly:form a 2003 group flash unsigned int notes[34]={65535,319,301,284,268,253,239,225,213,201,190,179,169,159,150,142,134,127,119,113,106,100,95,89,84,80,75,71,67,63,60,56,53,50}; flash unsigned char music0[2][183]={{25,26,25,23,21,0,25,0,25,26,28,25,21,0,23,0,23,25,23,20,16,0,23,25,23,21,18,0, 18,17,18,20,21,0,21,20,21,23,25,0,23,0,23,20,16,20,21,23,21,20,18,0, 18,17,18,20,21,0,21,0,21,20,21,23,25,0,23,0,23,20,16,20,21,23,21,20,18,0, 25,0,25,28,30,25,28,30,32,30,28,25,0,23,0,23,25,28,25,23,23,25,23,21,18,0, 25,0,25,28,30,25,28,30,32,30,28,25,0,23,0,23,25,28,25,23,23,25,23,21,18,0, 25,25,26,25,23,21,0,25,25,26,28,25,21,0,23,23,25,23,20,16,0,23,25,23,21,18,0, 25,25,26,25,23,21,0,25,25,26,28,25,21,0,23,23,25,23,20,16,0,23,25,23,21,18}, {12,6,6,6,23,1,5,1,6,6,6,6,23,1,5,1,6,6,6,6,11,1,6,6,6,6,12,12, 9,3,6,6,12,12,9,3,6,6,12,12,11,1,6,6,12,12,6,6,6,6,18,6, 9,3,6,6,12,6,5,1,9,3,6,6,12,12,11,1,6,6,12,12,6,6,6,6,18,6, 11,1,6,6,12,6,6,6,6,6,6,23,1,11,1,6,6,12,6,6,6,6,6,6,23,1, 11,1,6,6,12,6,6,6,6,6,6,23,1,11,1,6,6,12,6,6,6,6,6,6,23,7, 6,6,6,6,6,17,1,6,6,6,6,6,17,1,6,6,6,6,6,11,1,6,6,6,6,23,1, 6,6,6,6,6,17,1,6,6,6,6,6,17,1,6,6,6,6,6,11,1,6,6,6,6,24}}; flash unsigned char music1[2][163]={{27,23,20,0,20,0,22,0,23,0,20,22,23,27,23,23,0,20,0,22,0,23,0,20,22,23, 25,22,18,0,18,0,20,0,22,0,18,0,18,0,20,0,22,0,23,0,22,0,20,0,18,0,15,0, 27,23,20,0,20,0,22,0,23,0,20,0,22,0,23,0,27,0,27,0,28,0,30,0,28,0,27,0,28,0,27,23,0,23,0, 25,22,18,0,18,0,20,0,22,0,18,0,18,0,20,0,22,0,23,0,22,0,20,18,20,0,30,0,32,0,27,0,25,0, 18,0,20,0,18,0,20,0,18,0,20,0,20,0,20,0,23,0,20,0,18,0,20,0,18,0,20,0,18,0,20,0,20,0,20,0,23,0,20,0}, {12,12,4, 2,4, 2,5, 1,5, 1,12,6, 12, 12,12,4, 2,4, 2,5, 1,5, 1,12,6,12, 12,12,4,2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,24,24, 12,12,4,2,4, 2,4, 2,4, 2,10,2,4, 2,10,2,10,2,4, 2,4, 2,4, 2,4, 2,4, 2,4, 2,12, 4,2,10,2, 12,12,4,2, 4,2, 4,2, 4,2, 4,2, 4,2, 4,2, 4,2, 4,2, 4,2, 6,6, 10,2, 4,2, 10,2, 4,2,10,2, 4,2, 10,2,4,2,10,2,4,2, 10,2,4,2, 4,2, 4,2, 4 ,2, 4,2, 10,2, 4,2,10,2, 4,2,10,2, 4,2, 4,2,4,2,10,2}}; //Chicken Dance:from a 2003 group flash unsigned int music2[2][237]={{24,0,24,0,26,0,26,0,21,0,21,0,24,0,24,0,24,0,26,0,26,0,21,0,21,0,24,0, 24,0,24,0,26,0,26,0,29,0,29,0,28,0,24,26,29,28,0, 22,0,22,0,24,0,24,0,19,0,19,0,22,0,22,0,22,0,24,0,24,0,19,0,19,0,22,0, 23,0,24,0,26,0,24,0,22,0,24,0,21,0,23,24,26,24,22,21,0, 24,0,24,0,26,0,26,0,21,0,21,0,24,0,24,0,24,0,26,0,26,0,21,0,21,0,24,0, 24,0,24,0,26,0,26,0,29,0,29,0,28,0,24,26,29,28,0, 22,0,22,0,24,0,24,0,19,0,19,0,22,0,22,0,22,0,24,0,24,0,19,0,19,0,22,0, 24,0,24,0,26,0,26,0,28,0,28,0,29,0,28,26,24,22,21,19,17,0, 24,23,22,21,20,21,33,28,31,29,0, 24,23,22,21,20,21,29,31,28,0, 24,0,24,23,22,21,22,31,29,0,29,28,0, 29,31,29,24,26,28,24,28,31,29}, {4,1,4,1,4,1,4,1,4,1,4,1,5,5,4,1,4,1,4,1,4,1,4,1,4,1,5,5, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,10,10,10,9,1, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,4,1,4,1,4,1,4,1,4,1,4,1,5,5, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,5,5,5,5,10,9,1, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,4,1,4,1,4,1,4,1,4,1,4,1,5,5, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,10,10,10,9,1, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,4,1,4,1,4,1,4,1,4,1,4,1,5,5, 4,1,4,1,4,1,4,1,4,1,4,1,5,5,5,5,5,5,5,5,5,5, 10,10,10,20,10,10,30,10,20,29,1, 10,10,10,20,10,10,20,20,49,1, 9,1,10,10,20,10,10,30,9,1,20,29,1, 10,10,10,30,10,10,10,10,10,50}}; //arrow pattern [music][left:0, right:1][patnum] flash unsigned char pattern[3][2][60]={{{9,9,9,1,1,3,1,9,3,3,9,7,1,9,3,3,9,3,1,1, //song1 1,7,7,7,1,3,7,7,3,1,1,7,3,1,3,9,7,3,1,7, 3,1,3,7,1,3,3,7,3,1,9,7,3,7,1,7,3,9,7,3}, {9,9,9,1,1,1,7,7,9,5,1,9,1,7,9,5,7,1,9,9, 1,5,1,9,7,5,9,5,1,9,1,5,7,5,1,9,1,7,7,9, 1,9,5,7,5,1,9,5,7,7,9,1,1,7,9,1,7,9,7,5}}, {{9,9,9,1,1,3,1,1,9,3,9,7,9,1,3,3,3,3,1,1, //song2 1,9,7,9,1,3,7,9,3,9,1,7,3,1,9,7,7,3,1,7, 3,1,3,7,1,3,9,7,3,1,9,7,3,7,1,7,3,1,7,3}, {9,9,9,1,1,1,7,7,5,5,1,1,1,7,7,5,7,1,7,5, 1,5,1,5,9,5,7,9,1,9,1,5,7,9,1,7,1,9,7,7, 9,1,9,9,7,5,1,9,5,7,9,5,1,1,7,5,1,7,5,5}}, {{9,9,9,1,1,3,1,1,3,3,7,7,1,1,3,3,3,3,1,1, //song3 1,7,7,7,9,3,7,7,9,1,1,7,3,1,3,7,7,3,1,7, 3,1,9,7,1,3,3,7,3,1,7,7,3,7,1,7,3,1,7,3}, {9,9,9,1,1,1,7,7,5,5,1,1,1,7,7,5,7,1,7,5, 1,5,1,5,7,5,7,5,1,7,1,5,7,9,1,7,1,7,7,7, 1,1,5,7,5,1,7,5,7,7,5,1,1,9,5,1,7,5,7,5}} }; void PlayNote(void) { if (SelLevel!=2) audioT=BasicSpeed;//select song speed else audioT=HardSpeed; MusicTime++; if(SelSong==0){ if(MusicTime == music0[1][note]){ // to next note MusicTime= 0; if(++note >= length[0]) note = 0; // restart theh song temp = music0[0][note]; } } else if(SelSong==1){ if(MusicTime == music1[1][note]){ MusicTime = 0; if(++note >= length[1]) note = 0; temp = music1[0][note]; } } else if(SelSong==2){ if(MusicTime == music2[1][note]){ MusicTime = 0; if(++note >= length[2]) note = 0; temp = music2[0][note]; } } if((MusicTime == 0) && (temp != 0)) OCR0 = notes[temp]; }