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

📄 main.lst

📁 单片机乒乓球游戏机 可以再proteus仿真
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   MAIN                                                                  09/23/2008 04:07:57 PAGE 11  

 612   3                               state=Ball_MoveRightDown(speed);
 613   3                                       P3=0xFF;
 614   3                       moveflag=P3^7;
 615   3                                       switch(state)
 616   3                                       {
 617   4                                              case 0:
 618   4                                                if(moveflag) direction=3;
 619   4                                                else direction=7;
 620   4                                                break;
 621   4                                              //case 1://甲犯规,乙得分  
 622   4                                              //      gamenum.mark2++;
 623   4                                  //    put_chinese(chinese[20],6,10,1);
 624   4                                              //      break;
 625   4                                              case 2://乙犯规,甲得分 
 626   4                                                      gamenum.mark1++;
 627   4                                                      put_chinese(chinese[21],6,10,1);//yi
 628   4                                                      break;
 629   4                                       }
 630   3                                       break;
 631   3                        case 3:
 632   3                               state=Ball_MoveLeftUp(speed);
 633   3                                       P3=0xFF;
 634   3                       moveflag=P3^7;
 635   3                                       switch(state)
 636   3                                       {
 637   4                                              case 0:
 638   4                                                if(moveflag) direction=2;
 639   4                                                else direction=0;
 640   4                                                break;
 641   4                                              case 1://甲犯规,乙得分  
 642   4                                                      gamenum.mark2++;
 643   4                                      put_chinese(chinese[20],6,10,1);
 644   4                                                      break;
 645   4                                              //case 2://乙犯规,甲得分 
 646   4                                              //      gamenum.mark1++;
 647   4                                              //      put_chinese(chinese[21],6,10,1);
 648   4                                              //      break;
 649   4                                       }
 650   3                                       break;
 651   3                        case 4:
 652   3                               state=Ball_MoveLeftDown(speed);
 653   3                                       P3=0xFF;
 654   3                       moveflag=P3^7;
 655   3                                       switch(state)
 656   3                                       {
 657   4                                              case 0:
 658   4                                                if(moveflag) direction=5;
 659   4                                                else direction=6;
 660   4                                                break;
 661   4                                              case 1://甲犯规,乙得分  
 662   4                                                      gamenum.mark2++;
 663   4                                      put_chinese(chinese[20],6,10,1);
 664   4                                                      break;
 665   4                                              //case 2://乙犯规,甲得分 
 666   4                                              //      gamenum.mark1++;
 667   4                                              //      put_chinese(chinese[21],6,10,1);
 668   4                                              //      break;
 669   4                                       }
 670   3                                       break;
 671   3                        case 5:
 672   3                               state=Ball_MoveRightUp(speed);
 673   3                                       P3=0xFF;
C51 COMPILER V7.06   MAIN                                                                  09/23/2008 04:07:57 PAGE 12  

 674   3                       moveflag=P3^7;
 675   3                                       switch(state)
 676   3                                       {
 677   4                                              case 0:
 678   4                                                if(moveflag) direction=4;
 679   4                                                else direction=1;
 680   4                                                break;
 681   4                                              //case 1://甲犯规,乙得分  
 682   4                                              //      gamenum.mark2++;
 683   4                                  //    put_chinese(chinese[20],6,10,1);
 684   4                                              //      break;
 685   4                                              case 2://乙犯规,甲得分 
 686   4                                                      gamenum.mark1++;
 687   4                                                      put_chinese(chinese[21],6,10,1);
 688   4                                                      break;
 689   4                                       }
 690   3                                       break;
 691   3                        case 6:
 692   3                               state=Ball_MoveP(0xc0,1,7,speed);
 693   3                                       P3=0xFF;
 694   3                       moveflag=P3^7;
 695   3                                       switch(state)
 696   3                                       {
 697   4                                              case 0:
 698   4                                                if(moveflag) direction=3;
 699   4                                                else direction=7;
 700   4                                                break;
 701   4                                              //case 1://甲犯规,乙得分  
 702   4                                              //      gamenum.mark2++;
 703   4                                  //    put_chinese(chinese[20],6,10,1);
 704   4                                              //      break;
 705   4                                              case 2://乙犯规,甲得分 
 706   4                                                      gamenum.mark1++;
 707   4                                                      put_chinese(chinese[21],6,10,1);
 708   4                                                      break;
 709   4                                       }
 710   3                                       break;
 711   3                        case 7:
 712   3                               state=Ball_MoveP(0xc0,0,7,speed);
 713   3                                       P3=0xFF;
 714   3                       moveflag=P3^7;
 715   3                                       switch(state)
 716   3                                       {
 717   4                                              case 0:
 718   4                                                if(moveflag) direction=5;
 719   4                                                else direction=6;
 720   4                                                break;
 721   4                                              case 1://甲犯规,乙得分  
 722   4                                                      gamenum.mark2++;
 723   4                                      put_chinese(chinese[20],6,10,1);
 724   4                                                      break;
 725   4                                              //case 2://乙犯规,甲得分 
 726   4                                              //      gamenum.mark1++;
 727   4                                              //      put_chinese(chinese[21],6,10,1);
 728   4                                              //      break;
 729   4                                       }
 730   3                                       break;
 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                                                                  09/23/2008 04:07:57 PAGE 13  

 736   1      }
 737          /*******************************
 738          单人游戏
 739          ********************************/
 740          uchar singlaplay()
 741          {
 742   1         uchar i,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   2          LCD_WriteData(0x03,0,64+i);}
 751   1         for(i=0;i<64;i++){//下线
 752   2          LCD_WriteData(0xc0,7,64+i);}
 753   1         for(i=0;i<8;i++){
 754   2          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          singlaplay_send=send_ball(singlaplay_send);
 762   2          singla_modle_1(singlaplay_send.send_id);
 763   2          infodisplay();
*** WARNING C209 IN LINE 763 OF MAIN.C: 'infodisplay': too few actual parameters
 764   2              //比分局分控制
 765   2          if((gamenum.mark1>=11)&&((gamenum.mark1-gamenum.mark2)>=2))
 766   2                  {
 767   3                       a[gamenum.game1]=gamenum.mark1;
 768   3                       b[gamenum.game1]=gamenum.mark2;
 769   3                       gamenum.game1++;
 770   3                       gamenum.mark1=0;
 771   3                       gamenum.mark2=0;
 772   3                       singlaplay_send.send1=0;
 773   3                       singlaplay_send.send2=0;
 774   3                       put_chinese(chinese[20],0,64,1);
 775   3               put_chinese(chinese[13],0,80,1);
 776   3                       enter();LCD_CLR(R);
 777   3                       }
 778   2                else if((gamenum.mark2>=11)&&((gamenum.mark2-gamenum.mark1)>=2))
 779   2                  {
 780   3                       a[gamenum.game1]=gamenum.mark1;
 781   3                       b[gamenum.game1]=gamenum.mark2;
 782   3                       gamenum.game2++;
 783   3                       gamenum.mark1=0;
 784   3                       gamenum.mark2=0;
 785   3                       singlaplay_send.send1=0;
 786   3                       singlaplay_send.send2=0;
 787   3                       put_chinese(chinese[21],0,64,1);
 788   3               put_chinese(chinese[13],0,80,1);
 789   3                       enter();LCD_CLR(R);
 790   3                  }    
 791   2         if(gamenum.game2>=2) {flag=1;break;}
 792   2         else if(gamenum.game1>=2) {flag=0;break;}
 793   2         }
 794   1      
 795   1         infoflash(a,b,flag);
C51 COMPILER V7.06   MAIN                                                                  09/23/2008 04:07:57 PAGE 14  

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

 858   3                         }while(!(button==0x02));
 859   2                         break;
 860   2              }
 861   1              while(!state)
 862   1               {
 863   2                      state=Ball_MoveP(0x18,direction,3,speed);
 864   2                      switch(state)
 865   2                      {
 866   3                              case 0:
 867   3                                if(direction==0) direction=1;
 868   3                                else direction=0;
 869   3                                break;
 870   3                              case 1://甲犯规,乙得分  
 871   3                                      gamenum.mark2++;
 872   3                      put_chinese(chinese[20],6,10,1);
 873   3                                      break;
 874   3                              case 2://乙犯规,甲得分 
 875   3                                      gamenum.mark1++;
 876   3                                      put_chinese(chinese[21],6,10,1);
 877   3                                      break;
 878   3                      }
 879   2                      put_chinese(chinese[18],6,26,1);//犯规
 880   2                      put_chinese(chinese[19],6,42,1);
 881   2           }
 882   1      }
 883          
 884          void infodisplay()
 885          {
*** WARNING C236 IN LINE 885 OF MAIN.C: 'infodisplay': different length of parameter lists
 886   1          put_num(num10[gamenum.game1],0,24,1);//局分甲
 887   1              put_num(num10[gamenum.game2],2,24,1);//局分乙
 888   1              if(gamenum.mark1>9)
 889   1                put_num(num10[1],0,36,0);
 890   1              else put_num(num10[0],0,36,0);
 891   1      
 892   1              if(gamenum.mark1>9)
 893   1                put_num(num10[gamenum.mark1-10],0,44,0);
 894   1              else put_num(num10[gamenum.mark1],0,44,0);
 895   1      
 896   1              if(gamenum.mark2>9)
 897   1                put_num(num10[1],2,36,0);
 898   1              else put_num(num10[0],2,36,0);
 899   1      
 900   1              if(gamenum.mark2>9)
 901   1                put_num(num10[gamenum.mark2-10],2,44,0);
 902   1              else put_num(num10[gamenum.mark2],2,44,0);
 903   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   4899    ----
   CONSTANT SIZE    =     15    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      9      68
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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