📄 main.lst
字号:
C51 COMPILER V6.12 MAIN 11/03/2003 15:19:28 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\main.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE .\main.c LARGE BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <stdio.h>
2 #include <string.h>
3 #include "..\Inc\AT8xC51SND1.h"
4 #include "..\Inc\GLOBAL.h"
5 #include "..\Inc\CHIPSOURCE.h"
6 #include "..\Inc\COMMON.h"
7 #include "..\Inc\IDEIO.h"
8 #include "..\Inc\FAT32.h"
9 #include "..\Inc\MP3DECODER.h"
10 #include "..\Inc\LCD.h"
11 #include "mp3player.c"
12
13 WORD test=0;
14
15 xdata char filename1[100];
16
17 void main(void)
18 {
19 1 xdata WORD i,j=0;
20 1 xdata BYTE key,status,f2,function=0;
21 1
22 1 EA=1;
23 1
24 1 //初始化
25 1 LCDInit();
26 1 LCDPrint(0,Title);
27 1 InitPLL();
28 1 InitUART();
29 1 InitKEY();
30 1 // InitTimer0();
31 1 InitMP3Decoder();
32 1 IDEInit();
33 1
34 1 printf("ok\n");
35 1 printf("%bd Drivers found!\n",IDE.TotalDevices);
36 1 printf("Device 0 LBA: %ld\n",IDEDevice[0].TotalSectors);
37 1 printf("Device 1 LBA: %ld\n",IDEDevice[1].TotalSectors);
38 1
39 1 IDESetCurrentDevice(IDE_DEVICE_MASTER);
40 1
41 1 printf("Ready\n");
42 1 FAT32Init();
43 1 i=FAT32MountPartition();
44 1 printf("Mount Hard Disk Partition Table...ok\n");
45 1 i=FAT32MountVolumeID(0);
46 1 printf("\nMount Hard Disk Partition P%bd...ok\n",HDD.CurrentPartition);
47 1 printf("Total Size:\t%ld bytes\nFree Size:\t%ld bytes\n",FAT32DiskSize(),FAT32DiskFreeSize());
48 1 ShowDiskSize();
49 1 filename1[0]=0;
50 1 Play.CurrentPoint=1;
51 1 while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
52 1 printf("\n%d\n",Play.CurrentPoint);
53 1 function=1;
54 1 while(1)
55 1 {
C51 COMPILER V6.12 MAIN 11/03/2003 15:19:28 PAGE 2
56 2 key=GetKey();
57 2 printf("key:%bd\n",key);
58 2 switch (key)
59 2 {
60 3 case KEY_LEFT :
61 3 FunctionProcess(function,0);
62 3 break;
63 3 case KEY_RIGHT :
64 3 FunctionProcess(function,1);
65 3 break;
66 3 case KEY_UP :
67 3 function--;
68 3 if (function>MAX_MENU) function=MAX_MENU-1;
69 3 printf("%bd,%s\n",function,MenuList[function]);
70 3 LCDClearLine(0);
71 3 LCDPrint(0,MenuList[function]);
72 3 break;
73 3 case KEY_DOWN :
74 3 function=(++function)%MAX_MENU;
75 3 printf("%bd,%s\n",function,MenuList[function]);
76 3 LCDClearLine(0);
77 3 LCDPrint(0,MenuList[function]);
78 3 break;
79 3 case KEY_OK :
80 3 if (FAT32GetDirName(Play.CurrentPoint)==2)
81 3 {
82 4 strcpy((char *) filename1,(char *) LongFileName);
83 4 printf("%08lx->",FAT32.CurrentDirectory);
84 4 FAT32ChangeDirectory(filename1);
85 4 printf("%08lx->\n",FAT32.CurrentDirectory);
86 4 Play.CurrentPoint=1;
87 4 while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
88 4 LCDClearLine(1);
89 4 status=FAT32GetDirName(Play.CurrentPoint);
90 4 if (status==1)
91 4 {
92 5 printf("%bd FILE->",Play.CurrentPoint);
93 5 LCDPrint(0x10,"--");
94 5 }
95 4 else if (status==2)
96 4 {
97 5 printf("DIR->");
98 5 LCDPrint(0x10,"->");
99 5 }
100 4 printf("%s\n",LongFileName);
101 4 LCDPrint(0x11,LongFileName);
102 4 }
103 3 else
104 3 {
105 4 if (MP3.Playing)
106 4 {
107 5 if (AUDCON1&0x40)
108 5 MP3DecoderControl(MP3_PAUSE,0);
109 5 else
110 5 MP3DecoderControl(MP3_PAUSE,1);
111 5 }
112 4 else
113 4 {
114 5 if ((status=FAT32GetDirName(Play.CurrentPoint))==0) {j=1;status=FAT32GetDirName(Play.CurrentPoint);}
115 5 strcpy((char *) filename1,(char *) LongFileName);
116 5 f2=FAT32OpenFile(filename1);
117 5 if (f2==FAT32_ERR_FILE_OPEN_ERROR) {printf("fail to open file\n");}
C51 COMPILER V6.12 MAIN 11/03/2003 15:19:28 PAGE 3
118 5 else
119 5 {
120 6 printf("open file:%s \t%ld \t%lx\n",FCB[f2].FileName,FCB[f2].Size,FCB[f2].FirstCluster);
121 6 // InitMP3Decoder();
122 6 LoadMP3Data(f2);
123 6 }
124 5 }
125 4 }
126 3 break;
127 3 case KEY_CANCEL :
128 3 if (MP3.Playing)
129 3 {
130 4 MP3.Playing=0;
131 4 FAT32CloseFile(MP3.File);
132 4 printf("play over\n");
133 4 }
134 3 else
135 3 {
136 4 strcpy(filename1,".. ");
137 4 printf("%08lx->",FAT32.CurrentDirectory);
138 4 FAT32ChangeDirectory(filename1);
139 4 printf("%08lx->\n",FAT32.CurrentDirectory);
140 4 Play.CurrentPoint=1;
141 4 while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
142 4 LCDClearLine(1);
143 4 status=FAT32GetDirName(Play.CurrentPoint);
144 4 if (status==1)
145 4 {
146 5 printf("%bd FILE->",Play.CurrentPoint);
147 5 LCDPrint(0x10,"--");
148 5 }
149 4 else if (status==2)
150 4 {
151 5 printf("DIR->");
152 5 LCDPrint(0x10,"->");
153 5 }
154 4 printf("%s\n",LongFileName);
155 4 LCDPrint(0x11,LongFileName);
156 4 }
157 3 break;
158 3 }
159 2 }
160 1 }
161
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2382 ----
CONSTANT SIZE = 556 ----
XDATA SIZE = 1560 13
PDATA SIZE = ---- ----
DATA SIZE = 11 8
IDATA SIZE = ---- ----
BIT SIZE = ---- 1
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -