?? main.lst
字號:
C51 COMPILER V7.07 MAIN 05/23/2004 18:02:33 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN D:\ABC\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE BROWSE DEBUG OBJECTEXTEND OBJECT(D:\ABC\main.obj)
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\FAT.h"
9 #include "..\Inc\MP3DECODER.h"
10 #include "..\Inc\LCD.h"
11 #include "..\Inc\USB.h"
12 //#include "mp3player.c"
13
14 #define DEFAULT_PARTITION 0
15 #define ISNUMBER(X) (X>='0'&&X<='9')?1:0
16
17 extern xdata BYTE CommandBuffer[128];
18
19 xdata struct DirEntryPointStr MP3PlayDirPoint;
20 xdata BYTE filename[128];
21
22 void InitDisk(void);
23 void ListDisk(void);
24
25
26 void InitDisk(void)
27 {
28 1 if (MP3.Playing) {printf("播放狀態該功能禁用!\n");return;}
29 1 printf(" 初始化IDE...");
30 1 IDEInit(MainBuffer[0].DATA);
31 1 if (IDE.Devices) printf("ok!\n\n"); else {printf("error!\n\n");return;}
32 1 ListDisk();
33 1 }
34
35
36 void ListDisk(void)
37 {
38 1 if (IDE.Devices)
39 1 {
40 2 printf(" 發現 %bd 個IDE設備!\n",IDE.Devices);
41 2 printf(" 驅動器 總扇區數 總字節數\n");
42 2 printf(" ------ ------------ ---------------\n");
43 2 printf(" 1 %12lu %15lu\n",IDE.IDEDevice[0].TotalSectors,IDE.IDEDevice[0].TotalSectors*512);
44 2 if (IDE.Devices==2)
45 2 printf(" 1 %12lu %15lu\n",IDE.IDEDevice[1].TotalSectors,IDE.IDEDevice[2].TotalSectors*512);
46 2 printf("\n");
47 2 }
48 1 else
49 1 printf(" 錯誤!IDE設備未初始化,請先執行INIT DISK命令.\n\n");
50 1 }
51
52 void MountDisk(void)
53 {
54 1 data BYTE n;
55 1
C51 COMPILER V7.07 MAIN 05/23/2004 18:02:33 PAGE 2
56 1 if (MP3.Playing) {printf("播放狀態該功能禁用!\n");return;}
57 1 if (CommandBuffer[11]=='1') n=1;
58 1 else if (CommandBuffer[11]=='2') n=2;
59 1 else {printf(" 格式:MOUNT DISK [1|2]\n\n"); return;}
60 1
61 1 if (IDE.Devices&n)
62 1 {
63 2 if (n==1) IDESetCurrentDevice(IDE_DEVICE_MASTER);
64 2 else IDESetCurrentDevice(IDE_DEVICE_SLAVE);
65 2 printf(" 當前驅動器:%bd\n 初始化FAT文件系統...",(IDE.Devices&0xf0)>>4);
66 2 FATInit();
67 2 FATSetStorageMedia(FAT_MEDIA_TYPE_HDD);
68 2 FATGetPartitions();
69 2 printf("ok!\n\n");
70 2 }
71 1 else printf(" 未找到驅動器\n\n");
72 1 }
73
74 void ListDrive(void)
75 {
76 1 BYTE Part,i;
77 1
78 1 if (MP3.Playing) {printf("播放狀態該功能禁用!\n");return;}
79 1 printf(" 當前驅動器:%bd\n",(IDE.Devices&0xf0)>>4);
80 1 printf(" 總分區數:%bd\n",StorageMedia.TotalPartitions);
81 1
82 1 Part=StorageMedia.CurrentPartition;
83 1 for(i=0;i<StorageMedia.TotalPartitions;i++)
84 1 FATMountPartition(i);
85 1 if (Part!=255)
86 1 FATMountPartition(Part);
87 1 }
88
89 void MountDrive(void)
90 {
91 1 BYTE n;
92 1 BYTE temp[3];
93 1
94 1 if (MP3.Playing) {printf("播放狀態該功能禁用!\n");return;}
95 1 n=strlen(CommandBuffer);
96 1 if ((n==13&&ISNUMBER(CommandBuffer[12]))||(n==14&&ISNUMBER(CommandBuffer[12])&&ISNUMBER(CommandBuffer[13]
-)))
97 1 {
98 2 for(n=12;n<15;n++)
99 2 temp[n-12]=CommandBuffer[n];
100 2 n=(BYTE)atoi(temp);
101 2
102 2 if (n>=0&&n<StorageMedia.TotalPartitions)
103 2 {
104 3 FATMountPartition(n);
105 3 printf(" 當前分區:%bd\n\n",StorageMedia.CurrentPartition);
106 3 }
107 2 else
108 2 printf(" 分區號錯誤!\n\n");
109 2 }
110 1 else {printf(" 格式:MOUNT DRIVE [分區號]\n\n"); return;}
111 1 }
112
113 void Dir(void)
114 {
115 1 BYTE filename[128];
116 1 struct DirEntryPointStr temp;
C51 COMPILER V7.07 MAIN 05/23/2004 18:02:33 PAGE 3
117 1
118 1 if (MP3.Playing) {printf("播放狀態該功能禁用!\n");return;}
119 1 if (StorageMedia.CurrentPartition==255) {printf("未加載任何分區,請先用MOUNT DRIVE命令加載分區.\n"); retu
-rn;}
120 1 temp=FAT.DirEntryPoint;
121 1
122 1 do
123 1 {
124 2 FATGetFileName(filename,&(FAT.DirEntryPoint));
125 2 if (FATIsDirectory(&(FAT.DirEntryPoint))) printf("[%s]\n",filename);else printf("%s\n",filename);
126 2 }while(FATNextEntry(&(FAT.DirEntryPoint)));
127 1 FAT.DirEntryPoint=temp;
128 1 }
129
130 void Cd(void)
131 {
132 1 BYTE i=3;
133 1 BYTE filename[128];
134 1
135 1 struct DirEntryPointStr temp;
136 1
137 1 if (MP3.Playing) {printf("播放狀態該功能禁用!\n");return;}
138 1 if (StorageMedia.CurrentPartition==255) {printf("未加載任何分區,請先用MOUNT DRIVE命令加載分區.\n"); retu
-rn;}
139 1 temp=FAT.DirEntryPoint;
140 1
141 1 while(CommandBuffer[i]) {CommandBuffer[i-3]=CommandBuffer[i];i++;}
142 1 CommandBuffer[i-3]=0;
143 1 do
144 1 {
145 2 FATGetFileName(filename,&(FAT.DirEntryPoint));
146 2 if (strcmp(filename,CommandBuffer)==0) {i=0; break;}
147 2 }while(FATNextEntry(&(FAT.DirEntryPoint)));
148 1
149 1 if (i)
150 1 printf("目錄\"%s\"未找到.",CommandBuffer);
151 1 else
152 1 if (FATIsDirectory(&(FAT.DirEntryPoint))) {FATChangeDirectory(&(FAT.DirEntryPoint));return;}
153 1 else printf("\"%s\"不是一個目錄.",CommandBuffer);
154 1
155 1 FAT.DirEntryPoint=temp;
156 1 }
157
158 void Play(void)
159 {
160 1
161 1 BYTE i=3;
162 1 BYTE filename[128];
163 1
164 1 struct DirEntryPointStr temp;
165 1
166 1 if (StorageMedia.CurrentPartition==255) {printf("未加載任何分區,請先用MOUNT DRIVE命令加載分區.\n"); retu
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -