/************************************************************************* * Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * * All rights reserved. All use of this software and documentation is * * subject to the License Agreement located at the end of this file below.* ************************************************************************** * Description: * * The following is a simple hello world program running MicroC/OS-II.The * * purpose of the design is to be a very simple application that just * * demonstrates MicroC/OS-II running on NIOS II.The design doesn't account* * for issues such as checking system call return codes. etc. * * * * Requirements: * * -Supported Example Hardware Platforms * * Standard * * Full Featured * * Low Cost * * -Supported Development Boards * * Nios II Development Board, Stratix II Edition * * Nios Development Board, Stratix Professional Edition * * Nios Development Board, Stratix Edition * * Nios Development Board, Cyclone Edition * * -System Library Settings * * RTOS Type - MicroC/OS-II * * Periodic System Timer * * -Know Issues * * If this design is run on the ISS, terminal output will take several* * minutes per iteration. * **************************************************************************/ #include #include "includes.h" #include #include "io.h" /* Definition of Task Stacks */ #define TASK_STACKSIZE 2048 OS_STK task1_stk[TASK_STACKSIZE]; OS_STK task2_stk[TASK_STACKSIZE]; OS_STK task3_stk[TASK_STACKSIZE]; OS_STK task4_stk[TASK_STACKSIZE]; OS_STK task5_stk[TASK_STACKSIZE]; /* Definition of Task Priorities */ #define TASK1_PRIORITY 1 #define TASK2_PRIORITY 2 #define TASK3_PRIORITY 5 #define TASK4_PRIORITY 4 #define TASK5_PRIORITY 3 /**Notas * */ #define C3 130 #define Db3 138 #define D3 146 #define Eb3 155 #define E3 164 #define F3 174 #define Gb3 185 #define G3 196 #define Ab3 207 #define A3 220 #define Bb3 233 #define B3 246 #define C4 261 #define Db4 277 #define D4 293 #define Eb4 311 #define E4 329 #define F4 349 #define Gb4 369 #define G4 392 #define Ab4 415 #define A4 440 #define Bb4 466 #define B4 493 #define C5 523 #define Db5 544 #define D5 587 #define Eb5 622 #define E5 659 #define F5 698 #define Gb5 739 #define G5 783 #define Ab5 830 #define A5 880 #define Bb5 932 #define B5 987 #define C6 1046 #define Db6 1108 #define D6 1174 #define Eb6 1244 #define E6 1318 #define F6 1396 #define Gb6 1479 #define G6 1567 #define Ab6 1661 #define A6 1760 #define Bb6 1864 #define B6 1975 #define C7 2093 #define Db7 2217 #define D7 2349 #define Eb7 2489 #define E7 2637 #define F7 2794 #define Gb7 2960 #define G7 3136 #define Ab7 3322 #define A7 3520 #define Bb7 3729 #define B7 3951 #define full 600 #define half full / 2 void set_pos_image(int basex, int basey,int x, int y){// FUNCION PARA POSICIONAR IMAGENES IOWR(basex,0,x); IOWR(basey,0,y); } void init_game(void){// FUNCION PARA INICIALIZAR JUEGO IOWR(NOTA_BASE,0,0); IOWR(NOTA2_BASE,0,0); IOWR(NOTA3_BASE,0,0); IOWR(NOTA4_BASE,0,0); // INICIALIZO LA ESCALA DE CADA IMAGEN IOWR(SCALE1_BASE,0,0); IOWR(SCALE2_BASE,0,0); IOWR(SCALE3_BASE,0,0); IOWR(SCALE4_BASE,0,0); //APAGAO CADA IMAGEN AL INICIO DEL JUEGO A MENOS DE QUE QUIERA MOSTRARLAS IOWR(ON_OFF1_BASE,0,0); IOWR(ON_OFF2_BASE,0,0); IOWR(ON_OFF3_BASE,0,0); IOWR(ON_OFF4_BASE,0,0); //INICIALIZO LA POSICION DE LAS IMAGENES set_pos_image(GOKU_X1_BASE,GOKU_Y1_BASE,0, 0); set_pos_image(GOKU_X2_BASE,GOKU_Y2_BASE,30, 0); set_pos_image(GOKU_X3_BASE,GOKU_Y3_BASE,60, 0); set_pos_image(GOKU_X4_BASE,GOKU_Y4_BASE,90, 0); } void Sleep(int millseconds){ while(millseconds>0){ OSTimeDlyHMSM(0, 0, 0, 1); millseconds--; } } void Beep(float freq,int millseconds){ float note=(50000000/(freq*2))-1; IOWR(NOTA_BASE,0,(int)note); Sleep(millseconds); IOWR(NOTA_BASE,0,0); } void Beep2(float freq,int millseconds){ float note=(50000000/(freq*2))-1; IOWR(NOTA2_BASE,0,(int)note); Sleep(millseconds); IOWR(NOTA2_BASE,0,0); } void Beep3(float freq,int millseconds){ float note=(50000000/(freq*2))-1; IOWR(NOTA3_BASE,0,(int)note); Sleep(millseconds); IOWR(NOTA3_BASE,0,0); } void Beep4(float freq,int millseconds){ float note=(50000000/(freq*2))-1; IOWR(NOTA4_BASE,0,(int)note); Sleep(millseconds); IOWR(NOTA4_BASE,0,0); } void mix_Beep(int ch1,int ch2,float freq1,float freq2, int millseconds){ float note1=(50000000/(freq1*2))-1; float note2=(50000000/(freq2*2))-1; unsigned int base1=NOTA_BASE; switch(ch1){ case 0:base1=NOTA_BASE; break; case 1:base1=NOTA2_BASE; break; case 2:base1=NOTA3_BASE; break; case 3:base1=NOTA4_BASE; break; } unsigned int base2=NOTA_BASE; switch(ch2){ case 0:base2=NOTA_BASE; break; case 1:base2=NOTA2_BASE; break; case 2:base2=NOTA3_BASE; break; case 3:base2=NOTA4_BASE; break; } IOWR(base1,0,(int)note1); IOWR(base2,0,(int)note2); Sleep(millseconds); IOWR(base1,0,0); IOWR(base2,0,0); } // VARIABLES GLOBALES DE BOTONES unsigned char buttons_control1[12]; unsigned char buttons_control2[12]; void task1(void* pdata)// TASK PARA ANIMAR A goku { unsigned char animation=0; // inicializo todas las imagenes en el mismo punto set_pos_image(GOKU_X1_BASE,GOKU_Y1_BASE,0, 0); set_pos_image(GOKU_X2_BASE,GOKU_Y2_BASE,0, 0); set_pos_image(GOKU_X3_BASE,GOKU_Y3_BASE,0, 0); set_pos_image(GOKU_X4_BASE,GOKU_Y4_BASE,0, 0); while (1) { animation++; if(animation>3){animation=0;} switch(animation){ case 0: IOWR(ON_OFF1_BASE,0,1); IOWR(ON_OFF2_BASE,0,0); IOWR(ON_OFF3_BASE,0,0); IOWR(ON_OFF4_BASE,0,0); break; case 1: IOWR(ON_OFF1_BASE,0,0); IOWR(ON_OFF2_BASE,0,1); IOWR(ON_OFF3_BASE,0,0); IOWR(ON_OFF4_BASE,0,0); break; case 2: IOWR(ON_OFF1_BASE,0,0); IOWR(ON_OFF2_BASE,0,0); IOWR(ON_OFF3_BASE,0,1); IOWR(ON_OFF4_BASE,0,0); break; case 3: IOWR(ON_OFF1_BASE,0,0); IOWR(ON_OFF2_BASE,0,0); IOWR(ON_OFF3_BASE,0,0); IOWR(ON_OFF4_BASE,0,1); break; } //tiempo de retrazo OSTimeDlyHMSM(0, 0, 0, 100); } } void task2(void* pdata)// TASK PARA ADQUIRIR BOTONES { unsigned short snes1_control=0; while (1) { snes1_control=IORD(SNES_CONTROL2_BASE,0); buttons_control1[0]=snes1_control & 1;// B buttons_control1[1]=(snes1_control & 2)>>1;// Y buttons_control1[2]=(snes1_control & 4)>>2;// Start buttons_control1[3]=(snes1_control & 8)>>3;// select buttons_control1[4]=(snes1_control & 16)>>4;//UP buttons_control1[5]=(snes1_control & 32)>>5;//down buttons_control1[6]=(snes1_control & 64)>>6;//left buttons_control1[7]=(snes1_control & 128)>>7;//right buttons_control1[8]=(snes1_control & 256)>>8;//A buttons_control1[9]=(snes1_control & 512)>>9;//X buttons_control1[10]=(snes1_control & 1024)>>10;//L buttons_control1[11]=(snes1_control & 2048)>>11;//R snes1_control=IORD(SNES_CONTROL1_BASE,0); buttons_control2[0]=snes1_control & 1;// B buttons_control2[1]=(snes1_control & 2)>>1;// Y buttons_control2[2]=(snes1_control & 4)>>2;// Start buttons_control2[3]=(snes1_control & 8)>>3;// select buttons_control2[4]=(snes1_control & 16)>>4;//UP buttons_control2[5]=(snes1_control & 32)>>5;//down buttons_control2[6]=(snes1_control & 64)>>6;//left buttons_control2[7]=(snes1_control & 128)>>7;//right buttons_control2[8]=(snes1_control & 256)>>8;//A buttons_control2[9]=(snes1_control & 512)>>9;//X buttons_control2[10]=(snes1_control & 1024)>>10;//L buttons_control2[11]=(snes1_control & 2048)>>11;//R OSTimeDlyHMSM(0, 0, 0, 70); } } void shoot_task_sound(void* pdata)// TASK PARA sonido shoot { int i; for(i=2000; i<2500 ;i++){ mix_Beep(2,3,i,i*2, 1); } OSTaskDel(TASK5_PRIORITY); } void create_a_shoot_sound_task(){ OSTaskCreateExt(shoot_task_sound, NULL, (void *)&task5_stk[TASK_STACKSIZE-1], TASK5_PRIORITY, TASK5_PRIORITY, task5_stk, TASK_STACKSIZE, NULL, 0); } void task3(void* pdata)// TASK PARA MOVER A GOKU { unsigned int pos_x=0,pos_y=0; while (1) { if(buttons_control1[4]==0){ pos_y=pos_y-10; mix_Beep(2,3,8000,4000, 10); } if(buttons_control1[5]==0){ pos_y=pos_y+10; mix_Beep(2,3,8000,4000, 10); } if(buttons_control1[6]==0){ pos_x=pos_x-10; mix_Beep(2,3,1000,4000, 10); } if(buttons_control1[7]==0){ pos_x=pos_x+10; mix_Beep(2,3,500,4000, 10); } if(buttons_control1[9]==0){//X // cuando se oprime X, que se lance una aplicacion o task //para que suene el sonido de disparo create_a_shoot_sound_task(); } if (buttons_control1[8]==0) { int i; for(i=0;i<4;i++){ IOWR(SCALE1_BASE,0,i); IOWR(SCALE2_BASE,0,i); IOWR(SCALE3_BASE,0,i); IOWR(SCALE4_BASE,0,i); OSTimeDlyHMSM(0, 0, 0, 10); Beep2(1000*i, 10); } IOWR(SCALE1_BASE,0,0); IOWR(SCALE2_BASE,0,0); IOWR(SCALE3_BASE,0,0); IOWR(SCALE4_BASE,0,0); } if(buttons_control1[0]==0){ int i; for(i=0;i<10;i++){ pos_x=pos_x+10; set_pos_image(GOKU_X1_BASE,GOKU_Y1_BASE,pos_x, pos_y); set_pos_image(GOKU_X2_BASE,GOKU_Y2_BASE,pos_x, pos_y); set_pos_image(GOKU_X3_BASE,GOKU_Y3_BASE,pos_x, pos_y); set_pos_image(GOKU_X4_BASE,GOKU_Y4_BASE,pos_x, pos_y); OSTimeDlyHMSM(0, 0, 0, 7); Beep2(100*i, 10); } } if(buttons_control1[1]==0){ int i; for(i=0;i<10;i++){ pos_x=pos_x-10; set_pos_image(GOKU_X1_BASE,GOKU_Y1_BASE,pos_x, pos_y); set_pos_image(GOKU_X2_BASE,GOKU_Y2_BASE,pos_x, pos_y); set_pos_image(GOKU_X3_BASE,GOKU_Y3_BASE,pos_x, pos_y); set_pos_image(GOKU_X4_BASE,GOKU_Y4_BASE,pos_x, pos_y); OSTimeDlyHMSM(0, 0, 0, 7); Beep2(100*i, 10); } } set_pos_image(GOKU_X1_BASE,GOKU_Y1_BASE,pos_x, pos_y); set_pos_image(GOKU_X2_BASE,GOKU_Y2_BASE,pos_x, pos_y); set_pos_image(GOKU_X3_BASE,GOKU_Y3_BASE,pos_x, pos_y); set_pos_image(GOKU_X4_BASE,GOKU_Y4_BASE,pos_x, pos_y); OSTimeDlyHMSM(0, 0, 0, 50); } } void mario(); void tetris(); void jingle(); void starwars(); void gloria(); void happy(); void task4(void* pdata)// TASK PARA GENERAR AUDIO { unsigned int nota_div_freq[32]={56817,56817,47777,56817,42565,56817,37920,42565,47777,47777,37920,47777,31887,47777,37920,47777,63775,63775,50619,63775,47777,63775,42565,47777,71585,71585,56817,71585,50619,71585,47777,50619}; unsigned char count=0; //init div_freq IOWR(NOTA_BASE,0,0); while (1) { count++; if(count>31){ count=0; } IOWR(NOTA_BASE,0,nota_div_freq[count]); if(buttons_control1[8]==0){//A mario(); } else if(buttons_control1[9]==0){//X tetris(); } else if(buttons_control1[10]==0){//L jingle(); } else if(buttons_control1[11]==0){//R starwars(); } else if(buttons_control1[2]==0){//Select gloria(); } else if(buttons_control1[3]==0){//START happy(); } else{// si no se oprime nada OSTimeDlyHMSM(0, 0, 0, 170); } } } /* The main function creates two task and starts multi-tasking */ int main(void) { //INICIALIZO JUEGO ANTES DE LANZARLO init_game(); OSTaskCreateExt(task1, NULL, (void *)&task1_stk[TASK_STACKSIZE-1], TASK1_PRIORITY, TASK1_PRIORITY, task1_stk, TASK_STACKSIZE, NULL, 0); OSTaskCreateExt(task2, NULL, (void *)&task2_stk[TASK_STACKSIZE-1], TASK2_PRIORITY, TASK2_PRIORITY, task2_stk, TASK_STACKSIZE, NULL, 0); OSTaskCreateExt(task3, NULL, (void *)&task3_stk[TASK_STACKSIZE-1], TASK3_PRIORITY, TASK3_PRIORITY, task3_stk, TASK_STACKSIZE, NULL, 0); OSTaskCreateExt(task4, NULL, (void *)&task4_stk[TASK_STACKSIZE-1], TASK4_PRIORITY, TASK4_PRIORITY, task4_stk, TASK_STACKSIZE, NULL, 0); OSStart(); return 0; } void mario(){ Beep(1480,200); Beep(1568,200); Beep(1568,200); Beep(1568,200); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(783.99,200); Beep(369.99,200); Beep(392,200); Beep(369.99,200); Beep(392,200); Beep(392,400); Beep(196,400); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(739.99,200); Beep(783.99,200); Beep(880,200); Beep(830.61,200); Beep(880,200); Beep(987.77,400); Beep(880,200); Beep(783.99,200); Beep(698.46,200); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(739.99,200); Beep(783.99,200); Beep(880,200); Beep(830.61,200); Beep(880,200); Beep(987.77,400); Sleep(200); Beep(1108,10); Beep(1174.7,200); Beep(1480,10); Beep(1568,200); Sleep(200); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(739.99,200); Beep(783.99,200); Beep(783.99,200); Beep(739.99,200); Beep(783.99,200); Beep(880,200); Beep(830.61,200); Beep(880,200); Beep(987.77,400); Beep(880,200); Beep(783.99,200); Beep(698.46,200); Beep(659.25,200); Beep(698.46,200); Beep(784,200); Beep(880,400); Beep(784,200); Beep(698.46,200); Beep(659.25,200); Beep(587.33,200); Beep(659.25,200); Beep(698.46,200); Beep(784,400); Beep(698.46,200); Beep(659.25,200); Beep(587.33,200); Beep(523.25,200); Beep(587.33,200); Beep(659.25,200); Beep(698.46,400); Beep(659.25,200); Beep(587.33,200); Beep(493.88,200); Beep(523.25,200); Sleep(400); Beep(349.23,400); Beep(392,200); Beep(329.63,200); Beep(523.25,200); Beep(493.88,200); Beep(466.16,200); Beep(440,200); Beep(493.88,200); Beep(523.25,200); Beep(880,200); Beep(493.88,200); Beep(880,200); Beep(1760,200); Beep(440,200); Beep(392,200); Beep(440,200); Beep(493.88,200); Beep(783.99,200); Beep(440,200); Beep(783.99,200); Beep(1568,200); Beep(392,200); Beep(349.23,200); Beep(392,200); Beep(440,200); Beep(698.46,200); Beep(415.2,200); Beep(698.46,200); Beep(1396.92,200); Beep(349.23,200); Beep(329.63,200); Beep(311.13,200); Beep(329.63,200); Beep(659.25,200); Beep(698.46,400); Beep(783.99,400); Beep(440,200); Beep(493.88,200); Beep(523.25,200); Beep(880,200); Beep(493.88,200); Beep(880,200); Beep(1760,200); Beep(440,200); Beep(392,200); Beep(440,200); Beep(493.88,200); Beep(783.99,200); Beep(440,200); Beep(783.99,200); Beep(1568,200); Beep(392,200); Beep(349.23,200); Beep(392,200); Beep(440,200); Beep(698.46,200); Beep(659.25,200); Beep(698.46,200); Beep(739.99,200); Beep(783.99,200); Beep(392,200); Beep(392,200); Beep(392,200); Beep(392,200); Beep(196,200); Beep(196,200); Beep(196,200); Beep(185,200); Beep(196,200); Beep(185,200); Beep(196,200); Beep(207.65,200); Beep(220,200); Beep(233.08,200); Beep(246.94,200); } void tetris(){ Beep(658, 125); Beep(1320, 500); Beep(990, 250); Beep(1056, 250); Beep(1188, 250); Beep(1320, 125); Beep(1188, 125); Beep(1056, 250); Beep(990, 250); Beep(880, 500); Beep(880, 250); Beep(1056, 250); Beep(1320, 500); Beep(1188, 250); Beep(1056, 250); Beep(990, 750); Beep(1056, 250); Beep(1188, 500); Beep(1320, 500); Beep(1056, 500); Beep(880, 500); Beep(880, 500); Sleep(250); Beep(1188, 500); Beep(1408, 250); Beep(1760, 500); Beep(1584, 250); Beep(1408, 250); Beep(1320, 750); Beep(1056, 250); Beep(1320, 500); Beep(1188, 250); Beep(1056, 250); Beep(990, 500); Beep(990, 250); Beep(1056, 250); Beep(1188, 500); Beep(1320, 500); Beep(1056, 500); Beep(880, 500); Beep(880, 500); Sleep(500); Beep(1320, 500); Beep(990, 250); Beep(1056, 250); Beep(1188, 250); Beep(1320, 125); Beep(1188, 125); Beep(1056, 250); Beep(990, 250); Beep(880, 500); Beep(880, 250); Beep(1056, 250); Beep(1320, 500); Beep(1188, 250); Beep(1056, 250); Beep(990, 750); Beep(1056, 250); Beep(1188, 500); Beep(1320, 500); Beep(1056, 500); Beep(880, 500); Beep(880, 500); Sleep(250); Beep(1188, 500); Beep(1408, 250); Beep(1760, 500); Beep(1584, 250); Beep(1408, 250); Beep(1320, 750); Beep(1056, 250); Beep(1320, 500); Beep(1188, 250); Beep(1056, 250); Beep(990, 500); Beep(990, 250); Beep(1056, 250); Beep(1188, 500); Beep(1320, 500); Beep(1056, 500); Beep(880, 500); Beep(880, 500); Sleep(500); Beep(660, 1000); Beep(528, 1000); Beep(594, 1000); Beep(495, 1000); Beep(528, 1000); Beep(440, 1000); Beep(419, 1000); Beep(495, 1000); Beep(660, 1000); Beep(528, 1000); Beep(594, 1000); Beep(495, 1000); Beep(528, 500); Beep(660, 500); Beep(880, 1000); Beep(838, 2000); Beep(660, 1000); Beep(528, 1000); Beep(594, 1000); Beep(495, 1000); Beep(528, 1000); Beep(440, 1000); Beep(419, 1000); Beep(495, 1000); Beep(660, 1000); Beep(528, 1000); Beep(594, 1000); Beep(495, 1000); Beep(528, 500); Beep(660, 500); Beep(880, 1000); Beep(838, 2000); } void starwars(){ Beep(440,500); Beep(440,500); Beep(440,500); Beep(349,350); Beep(523,150); Beep(440,500); Beep(349,350); Beep(523,150); Beep(440,1000); Beep(659,500); Beep(659,500); Beep(659,500); Beep(698,350); Beep(523,150); Beep(415,500); Beep(349,350); Beep(523,150); Beep(440,1000); } void happy(){ unsigned FREQUENCY[]={392,392,440,392,523,494, 392,392,440,392,587,523, 392,392,784,659,523,494,440, 689,689,523,587,523}; unsigned DELAY[]={375,125,500,500,500,1000, 375,125,500,500,500,1000, 375,125,500,500,500,500,1000, 375,125,500,500,500,1000}; int CIRCLE; for(CIRCLE=0;CIRCLE<25;CIRCLE++) { Beep(FREQUENCY[CIRCLE],DELAY[CIRCLE]); } } void refrenSolo() { Beep(E5, half); Beep(E5, half); Beep(E5, half); Sleep(half); Beep(E5, half); Beep(E5, half); Beep(E5, half); Sleep(half); Beep(E5, half); Beep(G5, half); Beep(C5, half); Beep(D5, half); Beep(E5, half); Beep(C4, half); Beep(D4, half); Beep(E4, half); Beep(F5, half); Beep(F5, half); Beep(F5, half); Sleep(half); Beep(F5, half); Beep(E5, half); Beep(E5, half); Sleep(half); Beep(E5, half); Beep(D5, half); Beep(D5, half); Beep(E5, half); Beep(D5, half); Sleep(half); Beep(G5, half); Sleep(half); // ----------- Beep(E5, half); Beep(E5, half); Beep(E5, half); Sleep(half); Beep(E5, half); Beep(E5, half); Beep(E5, half); Sleep(half); Beep(E5, half); Beep(G5, half); Beep(C5, half); Beep(D5, half); Beep(E5, half); Beep(C4, half); Beep(D4, half); Beep(E4, half); Beep(F5, half); Beep(F5, half); Beep(F5, half); Sleep(half); Beep(F5, half); Beep(E5, half); Beep(E5, half); Sleep(half); Beep(G5, half); Beep(G5, half); Beep(F5, half); Beep(D5, half); Beep(C5, full); Sleep(full); } void coupleSolo() { Beep(G4, half); Beep(E5, half); Beep(D5, half); Beep(C5, half); Beep(G4, full); Sleep(half * 2); Beep(G4, half); Beep(E5, half); Beep(D5, half); Beep(C5, half); Beep(A4, full); Sleep(full); Beep(A4, half); Beep(F5, half); Beep(E5, half); Beep(D5, half); Beep(G5, full); Sleep(full); Beep(A5, half); Beep(A5, half); Beep(G5, half); Beep(Eb5, half); Beep(E5, full); Sleep(full); // ----------- Beep(G4, half); Beep(E5, half); Beep(D5, half); Beep(C5, half); Beep(G4, full); Sleep(full); Beep(G4, half); Beep(E5, half); Beep(D5, half); Beep(C5, half); Beep(A4, full); Sleep(full); Beep(A4, half); Beep(F5, half); Beep(E5, half); Beep(D5, half); Beep(G5, full); Sleep(full); Beep(A5, half); Beep(G5, half); Beep(F5, half); Beep(D5, half); Beep(C5, full); Sleep(full); } // ------------------------------------------------------------------- Bass Line void refrenBass() { Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(C4, half); Beep(C3, half); Beep(D3, half); Beep(E3, half); Beep(F4, full); Beep(C4, full); Beep(C4, full); Beep(G3, full); Beep(G3, full); Beep(D3, full); Beep(G3, full); Beep(G4, full); // ----------- Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(C4, half); Beep(C3, half); Beep(D3, half); Beep(E3, half); Beep(F4, full); Beep(C4, full); Beep(C4, full); Beep(G4, full); Beep(G4, half); Beep(G4, half); Beep(F4, half); Beep(D4, half); Beep(C4, full); Sleep(full); } void coupleBass() { Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(F3, full); Beep(C4, full); Beep(F3, full); Beep(C4, full); Beep(G3, full); Beep(D4, full); Beep(G3, full); Beep(D4, full); Beep(C4, full); Beep(G3, full); // ----------- Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(C4, full); Beep(G3, full); Beep(F3, full); Beep(C4, full); Beep(F3, full); Beep(C4, full); Beep(G3, full); Beep(D4, full); Beep(G3, full); Beep(D4, full); Beep(C4, full); Beep(G3, full); } void jingle(){ refrenSolo(); coupleSolo(); refrenSolo(); } void gloria(){ Beep(D5,full);//RE Beep(G5,full);//SOL Sleep(half/8); Beep(G5,full*3/2);//SOL Beep(Gb5,full*1/2);//FA# Beep(G5,full);//SOL Beep(B5,full);//SI Sleep(half/8); Beep(B5,full);//SI Beep(A5,full);//LA Beep(D6,full);//RE Sleep(half/8); Beep(D6,full);//RE Sleep(half/8); Beep(D6,full*3/2);//RE Beep(C6,full*1/2);//DO Beep(B5,full);//SI Beep(A5,full);//LA Beep(B5,full*2);//SI Beep(D5,full);//RE Sleep(half/4); Beep(G5,full);//SOL Sleep(half/8); Beep(G5,full*3/2);//SOL Beep(Gb5,full*1/2);//FA# Beep(G5,full);//SOL Beep(B5,full);//SI Sleep(half/8); Beep(B5,full);//SI Beep(A5,full);//LA Beep(D6,full);//RE Beep(A5,full);//LA Sleep(half/8); Beep(A5,full*3/2);//LA Beep(G5,full*1/2);//SOL Beep(Gb5,full);//FA# Beep(E5,full);//MI Beep(D5,full*2);//RE Beep(D6,full);//RE Sleep(half/8); Beep(D6,full);//RE Sleep(half/8); Beep(D6,full*3/2);//RE Beep(G5,full*1/2);//SOL Beep(C6,full);//DO Beep(B5,full);//SI Sleep(half/8); Beep(B5,full);//SI Beep(A5,full);//LA Beep(D6,full);//RE Sleep(half/8); Beep(D6,full);//RE Sleep(half/8); Beep(D6,full*3/2);//RE Beep(G5,full*1/2);//SOL Beep(C6,full);//DO Beep(B5,full);//SI Beep(A5,full*2);//LA Beep(E6,full);//MI Sleep(half/8); Beep(E6,full);//MI Sleep(half/8); Beep(E6,full*3/2);//MI Beep(D6,full*1/2);//RE Beep(C6,full);//DO Beep(B5,full);//SI Beep(C6,full*2);//DO Sleep(half/4); Beep(A5,full);//LA Beep(B5,full/2);//SI Beep(C6,full/2);//DO Beep(D6,full*3/2);//RE Beep(G5,full*1/2);//SOL Sleep(half/8); Beep(G5,full);//SOL Beep(A5,full);//LA Beep(B5,full*2);//SI Beep(E6,full);//MI Sleep(half/8); Beep(E6,full);//MI Sleep(half/8); Beep(E6,full*3/2);//MI Beep(D6,full/1/2);//RE Beep(C6,full);//DO Beep(B5,full);//SI Beep(C6,full*2);//DO Sleep(half/4); Beep(A5,full);//LA Beep(B5,full/2);//SI Beep(C6,full/2);//DO Beep(D6,full*3/2);//RE Beep(G5,full*1/2);//SOL Sleep(half/8); Beep(G5,full);//SOL Beep(Gb5,full);//FA# Beep(G5,full*2);//SOL } /****************************************************************************** * * * License Agreement * * * * Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * * All rights reserved. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the "Software"), * * to deal in the Software without restriction, including without limitation * * the rights to use, copy, modify, merge, publish, distribute, sublicense, * * and/or sell copies of the Software, and to permit persons to whom the * * Software is furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * * DEALINGS IN THE SOFTWARE. * * * * This agreement shall be governed in all respects by the laws of the State * * of California and by the laws of the United States of America. * * Altera does not recommend, suggest or require that this reference design * * file be used in conjunction or combination with any other product. * ******************************************************************************/