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