⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lst

📁 基于at89c52的乒乓球游戏系统
💻 LST
📖 第 1 页 / 共 3 页
字号:
 630   4                                              case 1://甲犯规,乙得分  
 631   4                                              gamenum.mark2++;
 632   4                                      put_chinese(chinese[20],6,10,1);
 633   4                                                      break;
 634   4                                              case 2://乙犯规,甲得分 
 635   4                                                      gamenum.mark1++;
 636   4                                                      put_chinese(chinese[21],6,10,1);//yi
 637   4                                                      break;
 638   4                                       }
 639   3                                       break;
 640   3                        case 3:
 641   3                               state=Ball_MoveLeftUp(speed);
 642   3                                       switch(state)
 643   3                                       {
 644   4                                              case 0:
 645   4                                                if(moveflag==ENTER) direction=0;
 646   4                                                else direction=2;
 647   4                                                break;
 648   4                                              case 1://甲犯规,乙得分  
 649   4                                                      gamenum.mark2++;
 650   4                                      put_chinese(chinese[20],6,10,1);
 651   4                                                      break;
 652   4                                              case 2://乙犯规,甲得分 
 653   4                                                      gamenum.mark1++;
 654   4                                              put_chinese(chinese[21],6,10,1);
 655   4                                              break;
 656   4                                       }
 657   3                                       break;
 658   3                        case 4:
 659   3                               state=Ball_MoveLeftDown(speed);
 660   3                                       switch(state)
 661   3                                       {
 662   4                                              case 0:
 663   4                                                if(moveflag==ENTER) direction=6;
 664   4                                                else direction=5;
 665   4                                                break;
 666   4                                              case 1://甲犯规,乙得分  
 667   4                                                      gamenum.mark2++;
 668   4                                      put_chinese(chinese[20],6,10,1);
 669   4                                                      break;
 670   4                                              case 2://乙犯规,甲得分 
 671   4                                                      gamenum.mark1++;
 672   4                                                      put_chinese(chinese[21],6,10,1);
 673   4                                                      break;
C51 COMPILER V7.06   MAIN                                                                  10/03/2008 17:28:23 PAGE 12  

 674   4                                       }
 675   3                                       break;
 676   3                        case 5:
 677   3                               state=Ball_MoveRightUp(speed);
 678   3                                       switch(state)
 679   3                                       {
 680   4                                              case 0:
 681   4                                                if(moveflag==UP) direction=1;
 682   4                                                else direction=4;
 683   4                                                break;
 684   4                                              case 1://甲犯规,乙得分  
 685   4                                                      gamenum.mark2++;
 686   4                                     put_chinese(chinese[20],6,10,1);
 687   4                                                      break;
 688   4                                              case 2://乙犯规,甲得分 
 689   4                                                      gamenum.mark1++;
 690   4                                                      put_chinese(chinese[21],6,10,1);
 691   4                                                      break;
 692   4                                       }
 693   3                                       break;
 694   3                        case 6:
 695   3                               state=Ball_MoveP(0xc0,1,7,speed,value);
 696   3                                       switch(state)
 697   3                                       {
 698   4                                              case 0:
 699   4                                                if(moveflag==UP) direction=7;
 700   4                                                else direction=3;
 701   4                                                break;
 702   4                                              case 1://甲犯规,乙得分  
 703   4                                                      gamenum.mark2++;
 704   4                                      put_chinese(chinese[20],6,10,1);
 705   4                                                      break;
 706   4                                              case 2://乙犯规,甲得分 
 707   4                                                      gamenum.mark1++;
 708   4                                                      put_chinese(chinese[21],6,10,1);
 709   4                                                      break;
 710   4                                       }
 711   3                                       break;
 712   3                        case 7:
 713   3                               state=Ball_MoveP(0xc0,0,7,speed,value);
 714   3                                       switch(state)
 715   3                                       {
 716   4                                              case 0:
 717   4                                                if(moveflag==ENTER) direction=6;
 718   4                                                else direction=5;
 719   4                                                break;
 720   4                                              case 1://甲犯规,乙得分  
 721   4                                                      gamenum.mark2++;
 722   4                                      put_chinese(chinese[20],6,10,1);
 723   4                                                      break;
 724   4                                              case 2://乙犯规,甲得分 
 725   4                                                      gamenum.mark1++;
 726   4                                                      put_chinese(chinese[21],6,10,1);
 727   4                                                      break;
 728   4                                       }
 729   3                                       break;
 730   3                       moveflag=0;
 731   3                      }
 732   2      
 733   2          }
 734   1          put_chinese(chinese[18],6,26,1);//犯规
 735   1          put_chinese(chinese[19],6,42,1);
C51 COMPILER V7.06   MAIN                                                                  10/03/2008 17:28:23 PAGE 13  

 736   1      }
 737          /*******************************
 738          单人游戏
 739          ********************************/
 740          uchar singlaplay()
 741          {
 742   1         uchar i,j=0,flag;
 743   1         uchar a[3]={0,0,0},b[3]={0,0,0};
 744   1         send_num singlaplay_send={0,0,0};//默认开始甲发球
 745   1         LCD_CLR(L);LCD_CLR(R);
 746   1         //画边框
 747   1         for(i=0;i<8;i++){//球与信息分割线
 748   2          LCD_WriteData(0xFF,i,63);}
 749   1        /* for(i=0;i<64;i++){//上线
 750   1          LCD_WriteData(0x03,0,64+i);}
 751   1         for(i=0;i<64;i++){//下线
 752   1          LCD_WriteData(0xc0,7,64+i);}
 753   1         for(i=0;i<8;i++){
 754   1          LCD_WriteData(0xFF,i,127);}//右边线 */
 755   1      
 756   1         put_chinese(chinese[20],0,4,0);//甲
 757   1         put_chinese(chinese[21],2,4,0);//乙
 758   1         for(;;){
 759   2      
 760   2          infodisplay();
*** WARNING C209 IN LINE 760 OF MAIN.C: 'infodisplay': too few actual parameters
 761   2          for(i=0;i<64;i++){//上线
 762   3           LCD_WriteData(0x03,0,64+i);}
 763   2          for(i=0;i<64;i++){//下线
 764   3           LCD_WriteData(0xc0,7,64+i);}
 765   2          singlaplay_send=send_ball(singlaplay_send);
 766   2          if(singla_modle_1(singlaplay_send.send_id)) return 1;;
 767   2          infodisplay();
*** WARNING C209 IN LINE 767 OF MAIN.C: 'infodisplay': too few actual parameters
 768   2              //比分局分控制
 769   2          if((gamenum.mark1>=11)&&((gamenum.mark1-gamenum.mark2)>=2))
 770   2                  {
 771   3                       a[j]=gamenum.mark1;
 772   3                       b[j]=gamenum.mark2;
 773   3                       gamenum.game1++;
 774   3                       gamenum.mark1=0;
 775   3                       gamenum.mark2=0;
 776   3                       singlaplay_send.send1=0;
 777   3                       singlaplay_send.send2=0;
 778   3                       put_chinese(chinese[20],0,64,1);
 779   3               put_chinese(chinese[13],0,80,1);
 780   3                       enter();LCD_CLR(R);j++;
 781   3                       }
 782   2                else if((gamenum.mark2>=11)&&((gamenum.mark2-gamenum.mark1)>=2))
 783   2                  {
 784   3                       a[j]=gamenum.mark1;
 785   3                       b[j]=gamenum.mark2;
 786   3                       gamenum.game2++;
 787   3                       gamenum.mark1=0;
 788   3                       gamenum.mark2=0;
 789   3                       singlaplay_send.send1=0;
 790   3                       singlaplay_send.send2=0;
 791   3                       put_chinese(chinese[21],0,64,1);
 792   3               put_chinese(chinese[13],0,80,1);
 793   3                       enter();LCD_CLR(R);j++;
 794   3                  }    
 795   2         if(gamenum.game2>=2) {flag=1;break;}
C51 COMPILER V7.06   MAIN                                                                  10/03/2008 17:28:23 PAGE 14  

 796   2         else if(gamenum.game1>=2) {flag=0;break;}
 797   2         }
 798   1      
 799   1         infoflash(a,b,flag);
 800   1         Delay_x10ms(1000);
 801   1         return 1;
 802   1      }
 803          void enter()
 804          {
 805   1         do{
 806   2            button=P2&0xF0;
 807   2         }while(!(button==ENTER));
 808   1      }
 809          
 810          
 811          void int0() interrupt 0 using 1
 812          {  
 813   1         P2=0xFF;
 814   1         buttonplay=1;
 815   1         button=P2&0x0F;
 816   1      }
 817          
 818          /*******************************
 819          发球控制。换发球每人两个
 820          ********************************/
 821          
 822          send_num send_ball(send_num singlaplay_send)
 823          {
 824   1        if(singlaplay_send.send2==2) {singlaplay_send.send_id=0;singlaplay_send.send2=0;}
 825   1        if(singlaplay_send.send1==2) {singlaplay_send.send_id=1;singlaplay_send.send1=0;}
 826   1      
 827   1        if(singlaplay_send.send_id) singlaplay_send.send2++;
 828   1        else singlaplay_send.send1++;
 829   1      
 830   1        return singlaplay_send;
 831   1      }
 832          
 833          /*******************************
 834          单人游戏-----
 835          ********************************/
 836          uchar singla_modle_1(uchar send_id)
 837          {
 838   1          uchar state=0;
 839   1          uchar direction,value;
 840   1              put_chinese(chinese[17],4,26,0);//发球
 841   1              put_chinese(chinese[16],4,42,0);
 842   1              switch(send_id)
 843   1              {
 844   2               case 0://甲发球
 845   2                         direction=1;
 846   2                 put_num(num10[10],0,53,0);//甲
 847   2                         put_num(num10[11],2,53,0);
 848   2                         put_chinese(chinese[20],4,10,0);
 849   2                         do//yifa
 850   2                         {
 851   3                               button=Read_P2();
 852   3                   pause();
 853   3                               if(pauseflag==EXIT) return 1;
 854   3                         }while(!(button==0x01));
 855   2                     break;
 856   2               case 1://乙发球
 857   2                         direction=0;
C51 COMPILER V7.06   MAIN                                                                  10/03/2008 17:28:23 PAGE 15  

 858   2                 put_num(num10[10],2,53,0);//乙
 859   2                         put_num(num10[11],0,53,0);
 860   2                         put_chinese(chinese[21],4,10,0);
 861   2                         do//jiafa
 862   2                         {
 863   3                              button=Read_P2();
 864   3                              pause();
 865   3                              if(pauseflag==EXIT) return 1;
 866   3                         }while(!(button==0x08));
 867   2                         break;
 868   2              }
 869   1              while(!state)
 870   1               {
 871   2                  if(direction) value=0x08;
 872   2                  else value=0x01;
 873   2                      state=Ball_MoveP(0x18,direction,3,speed,value);
 874   2                      switch(state)
 875   2                      {
 876   3                              case 0:
 877   3                                if(direction==0) direction=1;
 878   3                                else direction=0;
 879   3                                break;
 880   3                              case 1://甲犯规,乙得分  
 881   3                                      gamenum.mark2++;
 882   3                      put_chinese(chinese[20],6,10,1);
 883   3                                      break;
 884   3                              case 2://乙犯规,甲得分 
 885   3                                      gamenum.mark1++;
 886   3                                      put_chinese(chinese[21],6,10,1);
 887   3                                      break;
 888   3                      }
 889   2                      put_chinese(chinese[18],6,26,1);//犯规
 890   2                      put_chinese(chinese[19],6,42,1);
 891   2                      pauseflag=0;
 892   2           }
 893   1          return 0;
 894   1      }
 895          
 896          void infodisplay()
 897          {   
*** WARNING C236 IN LINE 897 OF MAIN.C: 'infodisplay': different length of parameter lists
 898   1         uchar i;
 899   1         for(i=0;i<8;i++){
 900   2          LCD_WriteData(0xFF,i,127);}//右边线
 901   1      
 902   1          put_num(num10[gamenum.game1],0,24,1);//局分甲
 903   1              put_num(num10[gamenum.game2],2,24,1);//局分乙
 904   1              if(gamenum.mark1>9)
 905   1                put_num(num10[1],0,36,0);
 906   1              else put_num(num10[0],0,36,0);
 907   1              if(gamenum.mark1>9)
 908   1                put_num(num10[gamenum.mark1-10],0,44,0);
 909   1              else put_num(num10[gamenum.mark1],0,44,0);
 910   1      
 911   1              if(gamenum.mark2>9)
 912   1                put_num(num10[1],2,36,0);
 913   1              else put_num(num10[0],2,36,0);
 914   1      
 915   1              if(gamenum.mark2>9)
 916   1                put_num(num10[gamenum.mark2-10],2,44,0);
 917   1              else put_num(num10[gamenum.mark2],2,44,0);
 918   1      } 
C51 COMPILER V7.06   MAIN                                                                  10/03/2008 17:28:23 PAGE 16  

 919          
 920          void  pause()
 921          {
 922   1          uchar i;
 923   1          if(pauseflag==DOWN){
 924   2              put_picture_half(Bmp1,R);
 925   2              while(pauseflag==DOWN);
 926   2              LCD_CLR(R);}
 927   1               
 928   1          for(i=0;i<8;i++){
 929   2          LCD_WriteData(0xFF,i,127);}//右边线
 930   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   5081    ----
   CONSTANT SIZE    =     15    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     11      75
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  5 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -