📄 fat16.lst
字号:
89 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
90
91 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
92 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
93 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
94 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,
95 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,
96
97 0x00,//active partion
98 0x00,//head
99 0x00,//partion begin
100 0x00,//cylinder
101 0x06,//is partion used
102 0x00,//end head
103 0x00,//partion end
104 0x00,//end cylinder
105 0x00,0x00,0x00,0x00,
C51 COMPILER V6.23a FAT16 11/27/2003 16:49:26 PAGE 3
106 0x00,0x80,0x00,0x00,//fist partion
107
108 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,//second partion
109 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,//third partion
110 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,//forth partion
111
112 0x55,0xAA // Offset_short int_Signature 510 //0x55AA
113
114 };
115
116
117 void WriteMBR2Flash(void)
118 {
119 1 if(Check_Flash_Id()==KM29U128_ID){
120 2 WritePage(Root_Cluster, BPB_Sector, BPB_Data);
121 2 }
122 1 else printu("\nKM29U128 is Not Found!");
123 1 }
124
125 void CreatFAT16(void)
126 {
127 1 short int i;
128 1 unsigned char *FAT=Page_Buf;
129 1 for(i=0;i<512;i++) FAT[i] = 0x00;
130 1 //disk type lower byte is equal to Offset_U8_BPB_Media
131 1 FAT[0] = 0xf8;
132 1 FAT[1] = 0xff;//system occupied the first cluster
133 1 FAT[2] = 0xff;
134 1 FAT[3] = 0x7f;
135 1
136 1 if(Check_Flash_Id()==KM29U128_ID){
137 2 WritePage(Root_Cluster,Fat_Sector,FAT); //Sector 1 of Fat16
138 2 WritePage(Root_Cluster,Fat_Sector+2,FAT); //Sector 1 of Fat16
139 2 FAT[0]=FAT[1]=FAT[2]=FAT[3]=0x00;
140 2 WritePage(Root_Cluster,Fat_Sector+1,FAT); //Sector 2 of Fat16
141 2 WritePage(Root_Cluster,Fat_Sector+3,FAT); //Sector 2 of Fat16
142 2 }
143 1 else printu("\nKM29U128 is Not Found!");
144 1 }
145
146 void CreatDirectoryEntry(void)
147 {
148 1 long int i;
149 1 unsigned char *Directory_Enties=Page_Buf;
150 1 for(i=0;i<512;i++) Directory_Enties[i]= 0x00;
151 1
152 1 if(Check_Flash_Id()==KM29U128_ID){
153 2 for(i=0;i<35;i++) {
154 3 WritePage(Root_Cluster+i/32,Directory_Sector+i%32,Directory_Enties);
155 3 // Delay(100);
156 3 }
157 2 }
158 1 else printu("\nKM29U128 is Not Found!");
159 1
160 1 }
161
162
163 //函数实现
164 void Format_Fat16Media(void)
165 {
166 1 Flash_Reset();
167 1 printu("\nFlash_Reset");
C51 COMPILER V6.23a FAT16 11/27/2003 16:49:26 PAGE 4
168 1 Erase_Cluster(Root_Cluster);
169 1 Erase_Cluster(Root_Cluster+1);
170 1
171 1 printu("\nErase_Cluster");
172 1 WriteMBR2Flash();
173 1 printu("\nWriteMBR2Flash");
174 1 CreatFAT16();
175 1 printu("\nCreatFAT16");
176 1 CreatDirectoryEntry();
177 1 printu("\nCreatDirectoryEntry");
178 1 }
179
180
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 725 ----
CONSTANT SIZE = 613 ----
XDATA SIZE = ---- 18
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -