?? function.lst
字號:
C51 COMPILER V8.02 FUNCTION 03/06/2007 17:42:14 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE FUNCTION
OBJECT MODULE PLACED IN function.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE function.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*獲取當前行,列*/
2 /*設置當前行,列*/
3 #include "lcdinit.h"
4 #include "data.h"
5 uchar g=0;
6 void delay(int c){
7 1 int i, j;
8 1 for(i = 0; i < c; i++)
9 1 for(j = 0; j < 1000; j++);
10 1 }
11
12 /*清屏 320 = (160/8) * (128/8) = 20 * 16 = 320*/
13 void cls(void){
14 1 int i;
15 1 set_xy((uchar)0,(uchar)0);
16 1 // for(i = 0; i < 320; i++)
17 1 // write_one(0x94,INC_WR);
18 1 for(i = 0; i < 128; i++)
19 1 write_one(0x94,INC_WR);
20 1
21 1 }
22
23
24 uchar curx,cury; /*紀錄當前人物所在位置*/
25
26 uchar level_temp[8][8]={
27 0,0,0,0,0,0,0,0,
28 0,0,0,0,0,0,0,0,
29 0,0,0,0,0,0,0,0,
30 0,0,0,0,0,0,0,0,
31 0,0,0,0,0,0,0,0,
32 0,0,0,0,0,0,0,0,
33 0,0,0,0,0,0,0,0,
34 0,0,0,0,0,0,0,0,
35 };
36
37
38 void wirte_bg(void){
39 1 int i;
40 1 set_adr(0x50,0x01);
41 1 for(i = 0; i < 2560; i++)
42 1 write_one(bg[i],INC_WR);
43 1 }
44
45 void wirte_cgrom(void){
46 1 int i;
47 1 // set_adr(0x50,0x01);
48 1 // for(i = 0; i < 2560; i++)
49 1 // write_one(0xff,INC_WR);
50 1 set_adr(0x00,0x0c);
51 1 /*自定義字符寫入CGROM*/
52 1 for(i = 0; i < 848; i++)
53 1 write_one(Lattice[i],INC_WR);
54 1 }
55
C51 COMPILER V8.02 FUNCTION 03/06/2007 17:42:14 PAGE 2
56 void start(void){
57 1 uchar i;
58 1 set_xy(0,0);
59 1 for(i=0;i<20;i++)
60 1 write_one(0x95,INC_WR);
61 1 set_xy(0,15);
62 1 for(i=0;i<20;i++)
63 1 write_one(0x95,INC_WR);
64 1 for(i=0;i<15;i++){
65 2 set_xy(0,i);
66 2 write_one(0x95,INC_WR);
67 2 set_xy(19,i);
68 2 write_one(0x95,INC_WR);
69 2 }
70 1 set_xy(18,1);
71 1 write_one(0x96,INC_WR);
72 1 set_xy(18,14);
73 1 write_one(0x97,INC_WR);
74 1 set_xy(1,1);
75 1 write_one(0x98,INC_WR);
76 1 set_xy(1,14);
77 1 write_one(0x99,INC_WR);
78 1
79 1 set_xy(7,6);
80 1 write_one(0xaa,INC_WR);
81 1 write_one(0xab,INC_WR);
82 1 write_one(0xae,INC_WR);
83 1 write_one(0xaf,INC_WR);
84 1 write_one(0xb2,INC_WR);
85 1 write_one(0xb3,INC_WR);
86 1 set_xy(7,7);
87 1 write_one(0xac,INC_WR);
88 1 write_one(0xad,INC_WR);
89 1 write_one(0xb0,INC_WR);
90 1 write_one(0xb1,INC_WR);
91 1 write_one(0xb4,INC_WR);
92 1 write_one(0xb5,INC_WR);
93 1
94 1 set_xy(6,8);
95 1 write_one(0x9a,INC_WR);
96 1 write_one(0x9b,INC_WR);
97 1 write_one(0x9e,INC_WR);
98 1 write_one(0x9f,INC_WR);
99 1 write_one(0xa2,INC_WR);
100 1 write_one(0xa3,INC_WR);
101 1 write_one(0xa6,INC_WR);
102 1 write_one(0xa7,INC_WR);
103 1 set_xy(6,9);
104 1 write_one(0x9c,INC_WR);
105 1 write_one(0x9d,INC_WR);
106 1 write_one(0xa0,INC_WR);
107 1 write_one(0xa1,INC_WR);
108 1 write_one(0xa4,INC_WR);
109 1 write_one(0xa5,INC_WR);
110 1 write_one(0xa8,INC_WR);
111 1 write_one(0xa9,INC_WR);
112 1 while(i){ /*此while語句判斷確定鍵超級技巧*/
113 2 switch(P1&0x1f){
114 3 case 0x0f:
115 3 i=0;
116 3 break;
117 3 }
C51 COMPILER V8.02 FUNCTION 03/06/2007 17:42:14 PAGE 3
118 2 }
119 1 }
120
121
122 void guan(void){
123 1 /*推*/
124 1 set_xy(16,0);
125 1 write_one(0xaa,INC_WR);
126 1 write_one(0xab,INC_WR);
127 1 set_xy(16,1);
128 1 write_one(0xac,INC_WR);
129 1 write_one(0xad,INC_WR);
130 1 /*箱*/
131 1 set_xy(16,2);
132 1 write_one(0xae,INC_WR);
133 1 write_one(0xaf,INC_WR);
134 1 set_xy(16,3);
135 1 write_one(0xb0,INC_WR);
136 1 write_one(0xb1,INC_WR);
137 1 /*子*/
138 1 set_xy(16,4);
139 1 write_one(0xb2,INC_WR);
140 1 write_one(0xb3,INC_WR);
141 1 set_xy(16,5);
142 1 write_one(0xb4,INC_WR);
143 1 write_one(0xb5,INC_WR);
144 1 /*第*/
145 1 set_xy(16,8);
146 1 write_one(0xd2,INC_WR);
147 1 write_one(0xd3,INC_WR);
148 1 set_xy(16,9);
149 1 write_one(0xd4,INC_WR);
150 1 write_one(0xd5,INC_WR);
151 1 /*幾*/
152 1 set_xy(16,10);
153 1 write_one(0xd6,INC_WR);
154 1 write_one(0xd6+2*(g+1),INC_WR);
155 1 set_xy(16,11);
156 1 write_one(0xd7,INC_WR);
157 1 write_one(0xd7+2*(g+1),INC_WR);
158 1 /*關*/
159 1 set_xy(16,12);
160 1 write_one(0xce,INC_WR);
161 1 write_one(0xcf,INC_WR);
162 1 set_xy(16,13);
163 1 write_one(0xd0,INC_WR);
164 1 write_one(0xd1,INC_WR);
165 1 /*阿*/
166 1 set_xy(18,0);
167 1 write_one(0x9a,INC_WR);
168 1 write_one(0x9b,INC_WR);
169 1 set_xy(18,1);
170 1 write_one(0x9c,INC_WR);
171 1 write_one(0x9d,INC_WR);
172 1 /*С*/
173 1 set_xy(18,2);
174 1 write_one(0x9e,INC_WR);
175 1 write_one(0x9f,INC_WR);
176 1 set_xy(18,3);
177 1 write_one(0xa0,INC_WR);
178 1 write_one(0xa1,INC_WR);
179 1 /*制*/
C51 COMPILER V8.02 FUNCTION 03/06/2007 17:42:14 PAGE 4
180 1 set_xy(18,4);
181 1 write_one(0xa2,INC_WR);
182 1 write_one(0xa3,INC_WR);
183 1 set_xy(18,5);
184 1 write_one(0xa4,INC_WR);
185 1 write_one(0xa5,INC_WR);
186 1 /*作*/
187 1 set_xy(18,6);
188 1 write_one(0xa6,INC_WR);
189 1 write_one(0xa7,INC_WR);
190 1 set_xy(18,7);
191 1 write_one(0xa8,INC_WR);
192 1 write_one(0xa9,INC_WR);
193 1 }
194
195
196
197
198 void printc(uchar i, uchar j, uchar c){
199 1 set_xy(i*2,j*2);
200 1 switch(c){
201 2 case 0:
202 2 write_one(0x94,INC_WR);
203 2 write_one(0x94,INC_WR);
204 2 set_xy(i*2,j*2+1);
205 2 write_one(0x94,INC_WR);
206 2 write_one(0x94,INC_WR);
207 2 break;
208 2 case 1: /*人物1*/
209 2 write_one(0x80,INC_WR);
210 2 write_one(0x81,INC_WR);
211 2 set_xy(i*2,j*2+1);
212 2 write_one(0x82,INC_WR);
213 2 write_one(0x83,INC_WR);
214 2 break;
215 2 case 2: /*磚頭2*/
216 2 write_one(0x84,INC_WR);
217 2 write_one(0x85,INC_WR);
218 2 set_xy(i*2,j*2+1);
219 2 write_one(0x86,INC_WR);
220 2 write_one(0x87,INC_WR);
221 2 break;
222 2 case 3: /*箱子3*/
223 2 write_one(0x88,INC_WR);
224 2 write_one(0x89,INC_WR);
225 2 set_xy(i*2,j*2+1);
226 2 write_one(0x8a,INC_WR);
227 2 write_one(0x8b,INC_WR);
228 2 break;
229 2 case 4: /*目的4*/
230 2 write_one(0x8c,INC_WR);
231 2 write_one(0x8d,INC_WR);
232 2 set_xy(i*2,j*2+1);
233 2 write_one(0x8e,INC_WR);
234 2 write_one(0x8f,INC_WR);
235 2 break;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -