📄 eluosi.lst
字号:
C51 COMPILER V7.06 ELUOSI 09/02/2008 17:59:01 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE ELUOSI
OBJECT MODULE PLACED IN eluosi.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE eluosi.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <REGX52.H>
*** WARNING C318 IN LINE 1 OF eluosi.c: can't open file 'REGX52.H'
2 #include<box.h>
*** WARNING C318 IN LINE 2 OF eluosi.c: can't open file 'box.h'
3
4 ////////////////////////////////////////////////////液晶引脚初始化
5 sbit Rs_Lcd=P3^5;
*** ERROR C202 IN LINE 5 OF ELUOSI.C: 'P3': undefined identifier
6 sbit Rw_Lcd=P3^6;
*** ERROR C202 IN LINE 6 OF ELUOSI.C: 'P3': undefined identifier
7 sbit En_Lcd=P3^7;
*** ERROR C202 IN LINE 7 OF ELUOSI.C: 'P3': undefined identifier
8 sbit Cs1_Lcd=P1^0;
*** ERROR C202 IN LINE 8 OF ELUOSI.C: 'P1': undefined identifier
9 sbit Cs2_Lcd=P1^1;
*** ERROR C202 IN LINE 9 OF ELUOSI.C: 'P1': undefined identifier
10 sfr DataBuss=0xa0; //P0作为Lcd的数据线
11 unsigned char dat=0;
12
13 ////////////////////////////////////////////////////按键引脚及其状态机初始值
14 #define key_state_0 0
15 #define key_state_1 1
16 #define key_state_2 2
17 unsigned char key_state[4]={0,0,0,0};
18
19 sbit key_up=P1^4;
*** ERROR C202 IN LINE 19 OF ELUOSI.C: 'P1': undefined identifier
20 sbit key_down=P3^3;
*** ERROR C202 IN LINE 20 OF ELUOSI.C: 'P3': undefined identifier
21 sbit key_left=P1^3;
*** ERROR C202 IN LINE 21 OF ELUOSI.C: 'P1': undefined identifier
22 sbit key_right=P3^2;
*** ERROR C202 IN LINE 22 OF ELUOSI.C: 'P3': undefined identifier
23 unsigned char i=0,j=0;
24 unsigned char down_time=0;
25 unsigned char crack_state=0;
26 unsigned char score=1;
27 ////////////////////////////////////////////////////液晶函数初始化
28 char RdStateLcd();
29 char WrCommandIc(unsigned char Command);
30 char WrCommandLcd(unsigned char Command);
31 char WrDataLcd(unsigned char dat);
32 char SetStarLine(char line);
33 void InitDis(void);
34 char SysInit(void);
35 char SetPageAddr(char page);
36 char SetYAddr(char y);
37 void ClrScreen(void);
38
39 ////////////////////////////////////////////////////一个像素点的显示清除
40 void Dispoint(unsigned char page,unsigned char y);
41 void Clrpoint(unsigned char page,unsigned char y);
42 ////////////////////////////////////////////////////延时和读取按键
43 void delay_us(unsigned int a);
44 void delay_ms(unsigned int a);
C51 COMPILER V7.06 ELUOSI 09/02/2008 17:59:01 PAGE 2
45 unsigned char read_key(unsigned char a,unsigned char key);
46
47 ////////////////////////////////////////////////////四个个像素点的显示清除
48 void onepoint(unsigned char x,unsigned char y);
49 void clr_onepoint(unsigned char x,unsigned char y);
50
51
52 ////////////////////////////////////////////////////显示地图
53 void show_ditu(void);
54 ////////////////////////////show game line
55 void game_line(void);
56 ///////show score
57 void show_score(void);
58 //mode:line(01 23 45 67):colum(08-120128):state
59 void DisChar(unsigned char *p,unsigned char page,unsigned char y,char state);
60
61
62 ////////////////////////////////////////////////////消除地图的全1行
63 void check_ditu(void);
64 ////////////////////////////////////////////////////写进地图0或1
65 void write_ditu(unsigned char x,unsigned char y,unsigned char z);
66 ////////////////////////////////////////////////////读出地图
67 unsigned char read_ditu(unsigned char x,unsigned char y);
68
69
70 ////////////////////////////////////////////////////产生一个方块
71 void Box_Generate(void);
72 ////////////////////////////////////////////////////写一个方块to地图
73 void Write_Box_ditu(void);
74 ////////////////////////////////////////////////////from titu erase a fangkuai
75 void Clr_Box_ditu(void);
76
77
78 ////////////////////////////if there hava box
79 unsigned char Check_Box_ditu();
80 ////////////////////////////if there is the game line
81 unsigned char Check_Box_gameline();
82 /////////////////////////////check if the box can ratate
83 unsigned char Check_Box_ditu_ratation(void);
84
85
86
87 /////////////////////////////move
88 void mov_left(void);
89 void mov_right(void);
90 void mov_ratation(void);
91 void mov_down(void);
92 ////////////////////////////////////////////////////
93 //line:31 colum:5*8
94 unsigned char idata tidu[31][5]={
95 0x00,0x00,0x00,0x00,0x00,//0
96 0x00,0x00,0x00,0x00,0x00,//1
97 0x00,0x00,0x00,0x00,0x00,//2
98 0x00,0x00,0x00,0x00,0x00,//3
99 0x00,0x00,0x00,0x00,0x00,//4
100 0x00,0x00,0x00,0x00,0x00,//5
101 0x00,0x00,0x00,0x00,0x00,//6
102 0x00,0x00,0x00,0x00,0x00,//7
103 0x00,0x00,0x00,0x00,0x00,//8
104 0x00,0x00,0x00,0x00,0x00,//9
105 0x00,0x00,0x00,0x00,0x00,//10
106 0x00,0x00,0x00,0x00,0x00,//11
C51 COMPILER V7.06 ELUOSI 09/02/2008 17:59:01 PAGE 3
107 0x00,0x00,0x00,0x00,0x00,//12
108 0x00,0x00,0x00,0x00,0x00,//13
109 0x00,0x00,0x00,0x00,0x00,//14
110 0x00,0x00,0x00,0x00,0x00,//15
111 0x00,0x00,0x00,0x00,0x00,//16
112 0x00,0x00,0x00,0x00,0x00,//17
113 0x00,0x00,0x00,0x00,0x00,//18
114 0x00,0x00,0x00,0x00,0x00,//19
115 0x00,0x00,0x00,0x00,0x00,//20
116 0x00,0x00,0x00,0x00,0x00,//21
117 0x00,0x00,0x00,0x00,0x00,//22
118 0x00,0x00,0x00,0x00,0x00,//23
119 0x00,0x00,0x00,0x00,0x00,//24
120 0x00,0x00,0x00,0x00,0x00,//25
121 0x00,0x00,0x00,0x00,0x00,//26
122 0xff,0xff,0xff,0xff,0xef,//30
123 0xff,0xff,0xff,0xff,0xef,//30
124 0xff,0xff,0xff,0xff,0xef,//30
125 0x00,0xff,0xff,0xff,0xef,//30
126 };
127 void main()
128 {
129 1 char SonState;
130 1
131 1 P0=0xff;
*** ERROR C202 IN LINE 131 OF ELUOSI.C: 'P0': undefined identifier
132 1 P1=0xff;
*** ERROR C202 IN LINE 132 OF ELUOSI.C: 'P1': undefined identifier
133 1 P2=0xff;
*** ERROR C202 IN LINE 133 OF ELUOSI.C: 'P2': undefined identifier
134 1 P3=0xff;
*** ERROR C202 IN LINE 134 OF ELUOSI.C: 'P3': undefined identifier
135 1 delay_ms(20);
136 1
137 1 do{
138 2 SonState=SysInit( );
139 2 }while(SonState!=0);
140 1
141 1 ClrScreen();
142 1
143 1 game_line();
144 1 show_ditu();
145 1
146 1 //mode:line(01 23 45 67):colum(08-120128):state
147 1 DisChar(fig[0],6,104,0);
*** ERROR C202 IN LINE 147 OF ELUOSI.C: 'fig': undefined identifier
148 1 DisChar(fig[0],6,112,0);
*** ERROR C202 IN LINE 148 OF ELUOSI.C: 'fig': undefined identifier
149 1 DisChar(fig[0],6,120,0);
*** ERROR C202 IN LINE 149 OF ELUOSI.C: 'fig': undefined identifier
150 1
151 1 while(1)
152 1 {
153 2 Box_Generate();
154 2 if((Check_Box_ditu())==0) { Write_Box_ditu();}//no crack
155 2 else { break;} //crack game over
156 2
157 2 while(1)
158 2 {
159 3 if(read_key(0,key_left))mov_left();
*** ERROR C202 IN LINE 159 OF ELUOSI.C: 'key_left': undefined identifier
160 3 if(read_key(1,key_right))mov_right();
C51 COMPILER V7.06 ELUOSI 09/02/2008 17:59:01 PAGE 4
*** ERROR C202 IN LINE 160 OF ELUOSI.C: 'key_right': undefined identifier
161 3 if(read_key(2,key_up))mov_ratation();
*** ERROR C202 IN LINE 161 OF ELUOSI.C: 'key_up': undefined identifier
162 3 if(read_key(3,key_down))mov_down();
*** ERROR C202 IN LINE 162 OF ELUOSI.C: 'key_down': undefined identifier
163 3 if(down_time>250){mov_down();}
164 3 delay_us(200);
165 3 down_time++;
166 3 if(crack_state==1){crack_state=0;break;}
167 3 }//while(1)
168 2
169 2 }//while(1)
170 1
171 1 }
172
173
174
175 //////////////////////////////////////////////////////////
176 //basic function
177 //////////////////////////////////////////////////////////
178 ///////////x:line y:colum
179 void onepoint(unsigned char x,unsigned char y)//show one point(2*2)
180 {
181 1 unsigned char i=0,j=0;
182 1 x=2*x;y=2*y;
183 1 for(i=x;i<(x+2);i++)
184 1 for(j=y;j<(y+2);j++)
185 1 {Dispoint(i,j);}
186 1 }
187
188 ///////////x:line y:colum
189 void clr_onepoint(unsigned char x,unsigned char y)//clear one point(2*2)
190 {
191 1 unsigned char i=0,j=0;
192 1 x=2*x;y=2*y;
193 1 for(i=x;i<(x+2);i++)
194 1 for(j=y;j<(y+2);j++)
195 1 {Clrpoint(i,j);}
196 1 }
197
198 void show_ditu()//show ditu:line(0-30)colum(1-40) ,line31 colun0&41 game line
199 {
200 1 for(j=0;j<31;j++)
201 1 for(i=0;i<5;i++)
202 1 {
203 2 if(tidu[j][i]&0x01){onepoint(j,8*i+1);}
204 2 if(tidu[j][i]&0x02){onepoint(j,8*i+2);}
205 2 if(tidu[j][i]&0x04){onepoint(j,8*i+3);}
206 2 if(tidu[j][i]&0x08){onepoint(j,8*i+4);}
207 2 if(tidu[j][i]&0x10){onepoint(j,8*i+5);}
208 2 if(tidu[j][i]&0x20){onepoint(j,8*i+6);}
209 2 if(tidu[j][i]&0x40){onepoint(j,8*i+7);}
210 2 if(tidu[j][i]&0x80){onepoint(j,8*i+8);}
211 2 }
212 1 }
213
214 void check_ditu()//check if the line is full then delete it
215 {
216 1 unsigned char aaa=0;
217 1 for(j=30;j>0;j--)//form down to up
218 1 {
219 2 if((tidu[j][0]==0xff)&&(tidu[j][1]==0xff)&&(tidu[j][2]==0xff)&&(tidu[j][3]==0xff)&&(tidu[j][4]==0xff))//fu
C51 COMPILER V7.06 ELUOSI 09/02/2008 17:59:01 PAGE 5
-ll
220 2 {
221 3 aaa=1; score++;
222 3 for(i=j;i>0;i--)
223 3 {
224 4 tidu[i][0]=tidu[i-1][0];
225 4 tidu[i][1]=tidu[i-1][1];
226 4 tidu[i][2]=tidu[i-1][2];
227 4 tidu[i][3]=tidu[i-1][3];
228 4 tidu[i][4]=tidu[i-1][4];
229 4 //show_one_Line(i);
230 4 }
231 3 tidu[0][0]=0;tidu[0][1]=0;tidu[0][2]=0;tidu[0][3]=0;//add ampty one line
232 3 //if there are many full lines together
233 3 if((tidu[j][0]==0xff)&&(tidu[j][1]==0xff)&&(tidu[j][2]==0xff)&&(tidu[j][3]==0xff)&&(tidu[j][4]==0xff))j++;
234 3 }
235 2
236 2 }//for(j=30;j>0;j--)
237 1 //updata ditu beacuse there have full line
238 1 if(aaa==1)
239 1 {
240 2 ClrScreen();
241 2 game_line();
242 2 show_ditu();
243 2 show_score();
244 2 }
245 1 //the better is show the change lines ,the no change not clear
246 1 }//void check_ditu()
247
248 //显示分数
249 void show_score(void)
250 {
251 1 unsigned char ge_wei=0,shi_wei=0,bai_wei=0;
252 1 if(score<10) {ge_wei=score;}
253 1 else if(score<100) {shi_wei=score/10;ge_wei=score%10;}
254 1 else {bai_wei=score/100;shi_wei=score%100/10;ge_wei=score%10;}
255 1
256 1 DisChar(fig[bai_wei],6,104,0);
*** ERROR C202 IN LINE 256 OF ELUOSI.C: 'fig': undefined identifier
257 1 DisChar(fig[shi_wei],6,112,0);
*** ERROR C202 IN LINE 257 OF ELUOSI.C: 'fig': undefined identifier
258 1 DisChar(fig[ge_wei],6,120,0);
*** ERROR C202 IN LINE 258 OF ELUOSI.C: 'fig': undefined identifier
259 1 }
260
261 ////////////////////////////写进地图x:line y:colum z=1写1 z=0写0 updata is fast
262 void write_ditu(unsigned char x,unsigned char y,unsigned char z)
263 {
264 1 char i=0,j=0;
265 1 ////////////////////////////////ditu[][0] form 1 not from 0
266 1 ////////////////////////////////ditu[][0]=y-1
267 1 y--;
268 1 i=y/8;
269 1 j=y%8;
270 1 if(z==1) {tidu[x][i]|=1<<j; onepoint(x,y+1);}
271 1 else if(z==0) {tidu[x][i]&=~(1<<j); clr_onepoint(x,y+1);}
272 1 }
273
274
275 ////////////////////////////读出地图x:line y:colum
276 unsigned char read_ditu(unsigned char x,unsigned char y)
277 {
C51 COMPILER V7.06 ELUOSI 09/02/2008 17:59:01 PAGE 6
278 1 char i=0,j=0,k=0;
279 1 ////////////////////////////////ditu[][0] form 1 not from 0
280 1 ////////////////////////////////ditu[][0]=y-1
281 1 y--;
282 1 i=y/8;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -