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

📄 main.lst

📁 《Proteus在MCS-51&ARM7系统中的应用百例》逆向之 Chapter 8 《Proteus在MCS-51&ARM7系统中的应用百例》MCS-51例子的C语言版本。 最
💻 LST
字号:
C51 COMPILER V8.08   MAIN                                                                  05/22/2007 10:48:40 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: D:\Program Files\Keil 8.08\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #include <intrins.h>
   3          typedef unsigned char BYTE;
   4          
   5          sbit P30=P3^0;
   6          sbit P31=P3^1;
   7          sbit P32=P3^2;
   8          sbit P33=P3^3;
   9          sbit P34=P3^4;
  10          sbit P35=P3^5;
  11          
  12          BYTE num;
  13          BYTE password[8];
  14          BYTE input[8];
  15          BYTE new_pass[8];
  16          BYTE error_count;
  17          
  18          BYTE code K1TAB[]={     0x81,0x41,0x21,0x11,
  19                                                  0x82,0x42,0x22,0x12,
  20                                                  0x84,0x44,0x24};
  21          
  22          
  23          void DELAY();
  24          BYTE KEY();
  25          void DISPLED();
  26          BYTE COMP();
  27          BYTE TestKey();
  28          BYTE CHPSW();
  29          
  30          
  31          main()
  32          {
  33   1              BYTE offset=0;
  34   1              BYTE KEY_t;
  35   1              num=8;
  36   1              
  37   1              do
  38   1              {
  39   2                      password[offset]=offset;
  40   2                      offset++;       
  41   2              }while(--num);
  42   1      
  43   1      MLOOP:
  44   1              P30=0;
  45   1              P31=1;
  46   1              P32=1;
  47   1              P33=1;
  48   1              P34=1;
  49   1      
  50   1              error_count=3;
  51   1              offset=0;
  52   1      
  53   1      GETPW:
  54   1              num=8;
  55   1              do
C51 COMPILER V8.08   MAIN                                                                  05/22/2007 10:48:40 PAGE 2   

  56   1              {
  57   2                      do
  58   2                      {
  59   3                              KEY_t=KEY();
  60   3                      }while(KEY_t==0x0A);
  61   2      
  62   2                      input[offset]=KEY_t;
  63   2                      DISPLED();
  64   2                      offset++;
  65   2              }while(--num);
  66   1              
  67   1              while(KEY()!=0x0A);
  68   1              DISPLED();
  69   1      
  70   1              if(!COMP()) goto GETPW;
  71   1      
  72   1              P30=1;
  73   1              P31=0;
  74   1      
  75   1              while(1)
  76   1              {
  77   2      wait:
  78   2                      if(P35)
  79   2                      {
  80   3                              if(!TestKey()) continue;
  81   3                              if(!CHPSW()) goto wait;
  82   3                      }
  83   2                      else
  84   2                      {
  85   3                              goto MLOOP;
  86   3                      }
  87   2              }
  88   1              
  89   1      }
  90          
  91          
  92          void DELAY()
  93          {
  94   1              BYTE i=0x80;
  95   1              do
  96   1              {
  97   2                      BYTE j=0xF8;
  98   2                      do
  99   2                      {
 100   3                              _nop_();
 101   3                              _nop_();
 102   3                      }while(--j);
 103   2              }while(--i);
 104   1      }
 105          
 106          
 107          BYTE COMP()
 108          {
 109   1              BYTE num=8;
 110   1              BYTE offset=0;
 111   1      
 112   1              do
 113   1              {
 114   2                      if(input[offset]!=password[offset])
 115   2                      {
 116   3                              P33=0;
 117   3                              DELAY();
C51 COMPILER V8.08   MAIN                                                                  05/22/2007 10:48:40 PAGE 3   

 118   3                              DELAY();
 119   3                              P33=1;
 120   3                              if(--error_count) return 0;
 121   3                              P34=0;
 122   3                              P33=0;
 123   3                              while(1);
 124   3                      }       
 125   2              }while(--num);
 126   1      }
 127          
 128          void DISPLED()
 129          {
 130   1              P32=0;
 131   1              DELAY();
 132   1              P32=1;
 133   1      }
 134          
 135          BYTE TestKey()
 136          {
 137   1              P1=0x0F;
 138   1              return ( (~P1)&0xF0 );                          
 139   1      }
 140          
 141          BYTE KEY()
 142          {
 143   1              BYTE offset;
 144   1              BYTE temp;
 145   1              BYTE temp2;
 146   1      
 147   1      
 148   1      KEY:
 149   1              do
 150   1              {
 151   2                      do
 152   2                      {
 153   3                              P1=0xF0;
 154   3                      }while(P1==0xF0);
 155   2              
 156   2                      DELAY();
 157   2                      P1=0xF0;
 158   2                      temp=P1;
 159   2              }while(temp==0xF0);
 160   1      
 161   1              P1=0x0F;
 162   1              if(P1==0x0F) goto KEY;
 163   1              else
 164   1              {
 165   2                      DELAY();
 166   2                      P1=0x0F;
 167   2                      temp2=P1;
 168   2                      if(temp2==0x0F) goto KEY;
 169   2                      else
 170   2                      {
 171   3                              temp=temp2&temp;
 172   3                              num=11;
 173   3                              offset=0;
 174   3      
 175   3                              do
 176   3                              {
 177   4                                      if(temp==K1TAB[offset])
 178   4                                      {
 179   5                                              while(P1!=0x0F);
C51 COMPILER V8.08   MAIN                                                                  05/22/2007 10:48:40 PAGE 4   

 180   5                                              DELAY();
 181   5                                              return offset;  
 182   5                                      }
 183   4                                      offset++;
 184   4                              }while(--num);
 185   3                      }
 186   2              }
 187   1      
 188   1      }
 189          
 190          
 191          BYTE CHPSW()
 192          {
 193   1              BYTE num=7;
 194   1              BYTE temp;
 195   1              BYTE offset;
 196   1      
 197   1              temp=KEY();
 198   1      
 199   1              if(temp!=0x0A) 
 200   1              {
 201   2                      new_pass[offset]=temp;
 202   2                      DISPLED();
 203   2      
 204   2                      do
 205   2                      {
 206   3                              do
 207   3                              {
 208   4                                      temp=KEY();     
 209   4                              }while(temp==0x0A);
 210   3                              new_pass[offset]=temp;
 211   3                              offset++;
 212   3                              DISPLED();
 213   3                      }while(--num);
 214   2                      
 215   2                      while(KEY()!=0x0A);
 216   2                      DISPLED();
 217   2                      num=8;
 218   2                      offset=0;
 219   2      
 220   2                      do
 221   2                      {
 222   3                              password[offset]=new_pass[offset];
 223   3                              offset++;       
 224   3                      }while(--num);
 225   2              }
 226   1              else
 227   1              {
 228   2                      return 0;
 229   2              }       
 230   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    325    ----
   CONSTANT SIZE    =     11    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     26       3
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.

C51 COMPILER V8.08   MAIN                                                                  05/22/2007 10:48:40 PAGE 5   


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

⌨️ 快捷键说明

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