📄 common.lst
字号:
C51 COMPILER V7.50 COMMON 08/18/2008 14:05:49 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE COMMON
OBJECT MODULE PLACED IN ..\output\output_bin\output_game\common.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\ap_game\src\common.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\
-..\bsp\include;..\..\code\ap_game\src\include;..\..\code\global;..\..\code\include) DEFINE(CONFIG_ASIC,dynamic_load) DEB
-UG OBJECTEXTEND PRINT(..\output\output_bin\output_game\common.lst) OBJECT(..\output\output_bin\output_game\common.obj)
line level source
1 /*******************
2 * common.c
3 *******************/
4 #include <string.h>
5 #include "api.h"
6 #include "lcd.h"
7 #include "common.h"
8 #include "display.h"
9 #include "ap_common.h"
10 #include "prefer.h"
11 #include "global_user.h"
12 #include "gameblock.h"
13 #include "res.h"
14 #include "res_show.h"
15
16 UINT32 u16TimerCount=0;
17
18 MUSIC_INFORMATION curr_music;
19 UINT16 curr_lyric_time;
20
21 INT8U _buf[256];
22 INT8U vol_flag=0;
23 FILE_INFORMATION curr_finfo, curr_dir, play_dir;
24 SCREENLEVEL screen_level;
25
26 UINT16 select;
27
28 UINT16 totdir, totfile, totitem;
29 UINT8 *search_extstr;
30
31
32 BOOLEAN bHotKeyHandle(UINT8 ekey)
33 {
34 1
35 1 switch(ekey)
36 1 {
37 2 case KEY_LONG_MENU:
38 2 delay(10);
39 2 key_menu_long = 1;
40 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
41 2 //close_volume();
42 2 #ifdef dynamic_load
43 2 api_vLoad(Code_USER1,1);
44 2 #else
Print("Load Function\n");
#endif
47 2 break;
48 2 case KEY_LONG_PLAY:
49 2 delay(10);
50 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
51 2 vShutDown();
52 2 break;
53 2 default:
C51 COMPILER V7.50 COMMON 08/18/2008 14:05:49 PAGE 2
54 2 return FALSE;
55 2 }
56 1 }
57
58 void key_process(UINT8 key)
59 {
60 1 u16TimerCount=0;
61 1
62 1 //vOpenBackLight();
63 1 if(bLCD_PIN_BACKLIGHT)
64 1 return;
65 1 //now handle hot key
66 1 bHotKeyHandle(key);
67 1
68 1 //deal other key now.
69 1 if(curr_screen->main)
70 1 curr_screen->main(key);
71 1 }
72
73 void get_short_name(FILE_INFORMATION *pfinfo, UINT8 xdata *buf)
74 {
75 1 UINT8 xdata *name = pfinfo->pu8FileName;
76 1 UINT8 xdata *ext = pfinfo->pu8FileExt;
77 1 BOOLEAN flags = false;
78 1
79 1 while(1) {
80 2 if(*name == '\0' || *name == ' ')
81 2 break;
82 2 *buf++ = *name++;
83 2 }
84 1
85 1 *buf++ = '.';
86 1
87 1 while(1) {
88 2 if(*ext == '\0' || *ext == ' ')
89 2 break;
90 2 *buf++ = *ext++;
91 2 flags = true;
92 2 }
93 1
94 1 if(!flags)
95 1 buf--;
96 1
97 1 *buf = '\0';
98 1 }
99
100 void get_long_name(FILE_INFORMATION *pfinfo, UINT8 xdata *buf)
101 {
102 1 UINT16 xdata *name = (UINT16 xdata *)pfinfo->pu8LongFileName;
103 1
104 1 while(*name != 0) {
105 2 buf[0] = ((UNION16 *)name)->v8[1];
106 2 buf[1] = ((UNION16 *)name)->v8[0];
107 2
108 2 if(*(UINT16 *)buf >= 'a' && *(UINT16 *)buf <= 'z')
109 2 *(UINT16 *)buf = *(UINT16 *)buf - 'a' + 'A';
110 2
111 2 name++;
112 2 buf += 2;
113 2 }
114 1
115 1 *(UINT16 *)buf = 0;
C51 COMPILER V7.50 COMMON 08/18/2008 14:05:49 PAGE 3
116 1 }
117
118
119 BOOLEAN change_dir(FILE_INFORMATION *pDir)
120 {
121 1 if(pDir)
122 1 memcpy(&curr_dir, pDir, sizeof(FILE_INFORMATION));
123 1 else
124 1 curr_dir.u32startclus = 0; // ROOT dir
125 1
126 1 return api_bChangeDir(pDir);
127 1 }
128
129 void scan_dir_file(UINT8 search_mode, UINT8 *extstr, BOOLEAN select_dir)
130 {
131 1 select = totitem = totdir = totfile = 0;
132 1
133 1 if(api_bSearchDirInDir(search_mode))
134 1 totdir = api_u16GetTotalFile();
135 1
136 1 if(api_bSearchFileInDir(search_mode, extstr))
137 1 totfile = api_u16GetTotalFile();
138 1
139 1 if(select_dir && totdir)
140 1 if(!api_bSearchDirInDir(SEARCH_MODE_CURRDIR))
141 1 return;
142 1
143 1 totitem = totdir + totfile;
144 1 search_extstr = extstr;
145 1 }
146
147 BOOLEAN playdir_valid()
148 {
149 1 if(curr_dir.u32startclus != play_dir.u32startclus)
150 1 return false;
151 1 else
152 1 return true;
153 1 }
154
155 BOOLEAN init_volume(void)
156 {
157 1 //*(INT8U xdata*)(0xF96E) = 0x00;
158 1 api_bSetVolume(tUserPreference.u8Volume);
159 1 return 1;
160 1 }
161
162 BOOLEAN close_volume(void)
163 {
164 1 api_bSetVolume(0-api_s8GetVolume());
165 1 //*(INT8U xdata*)(0xF96E) = 0x03;
166 1 return 1;
167 1 }
168
169
170 //--------------------------------------------------------------------------
171 void vKeyTimeOut(void)
172 {
173 1 if (u16TimerCount == 0)
174 1 {
175 2 if (tUserPreference.u8BackLightTime!=0)
176 2 vOpenBackLight();
177 2 }
C51 COMPILER V7.50 COMMON 08/18/2008 14:05:49 PAGE 4
178 1 u16TimerCount++;
179 1 if((u16TimerCount>=tUserPreference.u8BackLightTime*4) && (tUserPreference.u8BackLightTime>0))
180 1 vCloseBackLight();
181 1
182 1 if((u16TimerCount>=tUserPreference.u8ShutDownTime*240) && (tUserPreference.u8ShutDownTime>0))
183 1 vShutDown();
184 1
185 1 }
186
187 void vShutDown()
188 {
189 1 INT16U i;
190 1
191 1 api_bSetVolume(0-api_s8GetVolume());
192 1 for(i=0;i<9;i++)
193 1 {
194 2 delay(20);
195 2 bResShowPic(GJI01+i,0,0);
196 2 }
197 1
198 1 delay(20);
199 1 vCloseBackLight();
200 1 lcd_clear();
201 1 delay(20);
202 1
203 1 api_bSetPowerDownMode(POWER_DOWN_ADDA_OFF);
204 1 delay(200);
205 1 b_PIN_POWEROFF = 0;
206 1 while(1){;}
207 1 }
208
209 void vOpenBackLight(void)
210 {
211 1 bLCD_PIN_BACKLIGHT = 0;
212 1 }
213
214 void vCloseBackLight(void)
215 {
216 1 bLCD_PIN_BACKLIGHT = 1;
217 1 }
218
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 918 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 344 19
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- 2
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -