📄 u_func_b.lst
字号:
248 4 }
249 3 }
250 2 Temp_Ofst-=32;
251 2 }while(*(pt+Temp_Ofst+32)<0x3f);
252 1 Rd_Sector_b(Rd_Rec.Currt_Sect);
253 1 }
254
255 unsigned char Dis_Fat_In_Clust_b(unsigned long Menu_Clust)
256 {
257 1 unsigned long Menu_LBA;
258 1 unsigned char *na,i,j,rd_short=0;
259 1 unsigned char xdata *pt;
260 1 St_Ofst_b=0;
261 1 Currt_File=0;
262 1 File_Over=0;
263 1 Menu_LBA=(Menu_Clust-2)*sect_clust_b+root_b;
264 1 Rd_Rec.Currt_Sect=Rd_Rec.Last_Sect=Menu_LBA;
265 1 Rd_Rec.Next_Sect=Rd_Rec.Currt_Sect+1;
266 1
267 1
268 1 while(Rd_Rec.Currt_Sect-Menu_LBA<sect_clust_b) //读完整个簇
269 1 {
270 2 Rd_Sector_b(Rd_Rec.Currt_Sect);
271 2 pt=Data_Buf;
*** WARNING C182 IN LINE 271 OF U_FUNC_B.C: pointer to different objects
272 2 if(*(pt+St_Ofst_b)!=0xe5&&*(pt+St_Ofst_b+11)!=0x0f&&*(pt+St_Ofst_b+11)!=0x08&&*(pt+St_Ofst_b)!=0x2e)
-//判断是否为有效文件
273 2 {
274 3 na=Fat[Currt_File].ext; //读扩展名
275 3 for(i=0;i<3;i++)
276 3 {
277 4 *(na+i)=*(pt+St_Ofst_b+8+i);
278 4 }
279 3
280 3 // Fat[Currt_File].St_Clust=*(pt+St_Ofst+0x1a)+*(pt+St_Ofst+0x1b)<<8+*(pt+St_Ofst+0x14)<<16; //定义Fat
-[Currt_File].St_Clust为一个长整型这样赋不了值?
281 3
282 3 Fat[Currt_File].St_Clust.num[3]=*(pt+St_Ofst_b+0x1a); //起始簇
283 3 Fat[Currt_File].St_Clust.num[2]=*(pt+St_Ofst_b+0x1b);
284 3 Fat[Currt_File].St_Clust.num[1]=*(pt+St_Ofst_b+0x14);
285 3 Fat[Currt_File].St_Clust.num[0]=*(pt+St_Ofst_b+0x15);
286 3 // Fat[Currt_File].Big=*(pt+St_Ofst+0x1c)+*(pt+St_Ofst+0x1d)<<8+*(pt+St_Ofst+0x1e)<<16+*(pt+St_Ofst+0x1f
-)<<24; //这个跟Fat[Currt_File].St_Clust一样赋不了??
287 3 Fat[Currt_File].Big.num[0]=*(pt+St_Ofst_b+0x1f); //文件大小
288 3 Fat[Currt_File].Big.num[1]=*(pt+St_Ofst_b+0x1e);
289 3 Fat[Currt_File].Big.num[2]=*(pt+St_Ofst_b+0x1d);
290 3 Fat[Currt_File].Big.num[3]=*(pt+St_Ofst_b+0x1c);
291 3
292 3 Fat[Currt_File].Sector=Rd_Rec.Currt_Sect; //文件目录项所在的扇区
293 3 Fat[Currt_File].Ofst=St_Ofst_b; //文件目录项所在的偏移量
294 3
C51 COMPILER V8.02 U_FUNC_B 07/21/2008 09:40:01 PAGE 6
295 3 if(*(pt+St_Ofst_b+6)==0x7e||*(pt+St_Ofst_b+5)==0x7e)
296 3 for(i=0;i<8;i++)
297 3 {
298 4 if(*(pt+St_Ofst_b+i)>0x7e)
299 4 {
300 5 rd_short=1;
301 5 break;
302 5 }
303 4 else rd_short=0;
304 4 }
305 3 else rd_short=1;
306 3 if(rd_short) //是否为短文件名或是中文名
307 3 {
308 4 na=Fat[Currt_File].name;
309 4 for(j=0;j<8;j++)
310 4 *(na+j)=*(pt+St_Ofst_b+j);
311 4 *(na+8)=0;
312 4 }
313 3 else //若是长文件名
314 3 Get_Lfat_b();
315 3 Currt_File++;
316 3 // if(Currt_File==4) return Currt_File;
317 3 }
318 2 St_Ofst_b+=32;
319 2
320 2 if(St_Ofst_b==512)
321 2 {
322 3 St_Ofst_b=0;
323 3 Rd_Rec.Currt_Sect++;
324 3 Rd_Rec.Last_Sect=Rd_Rec.Currt_Sect-1;
325 3 Rd_Rec.Next_Sect=Rd_Rec.Currt_Sect+1;
326 3 Sect_Ofst_b++;
327 3 // return Currt_File; //
328 3 }
329 2 if(*(pt+St_Ofst_b)==0)
330 2 {
331 3 St_Ofst_b=0;
332 3 return 0xff; //文件名已读完,返回0xff
333 3 }
334 2 }
335 1 return Currt_File;
336 1 }
337
338 unsigned char Key_Opare_b()
339 {
340 1 signed char Key,i=0,j;
341 1 // LCD_Printf(1,1,">>");
342 1 CurrtChainNum=0;
343 1 while(1)
344 1 {
345 2 Key=Wait_Infrared();
346 2 switch(Key)
347 2 {
348 3 case UP: i--;break;
349 3 case DOWN: i++;break;
350 3 case OK: Opr_Menu_b(i);i=0;break;
351 3 case CANCEL: if(CurrtChainNum==0) break;
352 3 CurrtChainNum-=2;
353 3 i=0;
354 3 Dis_Fat_In_Clust_b(ClustChain[CurrtChainNum]);
355 3 CurrtChainNum++;
356 3 break;
C51 COMPILER V8.02 U_FUNC_B 07/21/2008 09:40:01 PAGE 7
357 3 case 0x0b: return 0;
358 3 }
359 2 if(i>=Currt_File) i=Currt_File-1;
360 2 if((i/4)==(Currt_File/4))
361 2 {
362 3 j=1;
363 3 LCD_Clear ();
364 3 while((j+(i/4)*4)<=Currt_File)
365 3 {
366 4 PrintfFat(j,2,(j-1)+(i/4)*4);
367 4 j++;
368 4 }
369 3 }
370 2 else
371 2 {
372 3 // LCD_Clear ();
373 3 for(j=1;j<=4;j++)
374 3 PrintfFat(j,2,(j-1)+(i/4)*4);
375 3 }
376 2 switch(i%4)
377 2 {
378 3 case -1: i=0;break;
379 3 // case 4: return 0x00;
380 3 case 0: LCD_Printf(1,1,">>");
381 3 LCD_Printf(2,1," ");
382 3 LCD_Printf(3,1," ");
383 3 LCD_Printf(4,1," ");
384 3 break;
385 3 case 1: LCD_Printf(2,1,">>");
386 3 LCD_Printf(1,1," ");
387 3 LCD_Printf(3,1," ");
388 3 LCD_Printf(4,1," ");
389 3 break;
390 3 case 2: LCD_Printf(3,1,">>");
391 3 LCD_Printf(2,1," ");
392 3 LCD_Printf(1,1," ");
393 3 LCD_Printf(4,1," ");
394 3 break;
395 3 case 3: LCD_Printf(4,1,">>");
396 3 LCD_Printf(2,1," ");
397 3 LCD_Printf(3,1," ");
398 3 LCD_Printf(1,1," ");
399 3 break;
400 3 }
401 2 }
402 1 }
403
404
405
406 void Opr_Menu_b(unsigned char file_num)
407 {
408 1 unsigned char *pt,Remain;
409 1 unsigned long FirstClustA;
410 1 pt=Fat[file_num].ext;
411 1 if(CurrtChainNum==0)
412 1 {
413 2 ClustChain[CurrtChainNum]=2;
414 2 CurrtChainNum=1;
415 2 }
416 1 if(*(pt)==0x20)
417 1 {
418 2 ClustChain[CurrtChainNum]=Fat[file_num].St_Clust.value;
C51 COMPILER V8.02 U_FUNC_B 07/21/2008 09:40:01 PAGE 8
419 2 CurrtChainNum++;
420 2 Dis_Fat_In_Clust_b(Fat[file_num].St_Clust.value);
421 2 }
422 1 else
423 1 {
424 2 LCD_Clear ();
425 2 LCD_Printf(2,2,"发送到另一盘?");
426 2 if(Wait_Infrared()==OK)
427 2 {
428 3 LCD_Clear ();
429 3 LCD_Printf(2,2,"正在发送...");
430 3 FirstClustA=WrFAT_a(file_num);
431 3 do{
432 4 Remain=ReadBB(file_num);
433 4 Remain=WriteBA(FirstClustA,file_num);
434 4 }while(Remain==0xff);
435 3
436 3 RdFDT_b(file_num);
437 3 WrFDT_a(FirstClustA);
438 3 Rd_Sector_a(root_b);
439 3 }
440 2 else return;
441 2 }
442 1 }
443
444
445 void RdFDT_b(unsigned char file_num)
446 {
447 1 unsigned char xdata *pt;
448 1 unsigned char i,j=0,LFile=0;
449 1 unsigned int temp_ofst;
450 1 pt=Data_Buf;
*** WARNING C182 IN LINE 450 OF U_FUNC_B.C: pointer to different objects
451 1 Rd_Sector_b(Fat[file_num].Sector);
452 1 temp_ofst=Fat[file_num].Ofst;
453 1 for(i=0;i<32;i++)
454 1 {
455 2 FDTBuf.Buf[i]=*(pt+temp_ofst+i);
456 2 FDTBuf.FDTNum=32;
457 2
458 2 if(*(pt+temp_ofst+i)>=0x7e&&i<8)
459 2 LFile=1;
460 2
461 2 }
462 1 j=1;
463 1 if(LFile==0) return;
464 1
465 1 do
466 1 {
467 2 if(temp_ofst==0)
468 2 {
469 3 Rd_Sector_b(Fat[file_num].Sector-1);
470 3 temp_ofst=512;
471 3 }
472 2 temp_ofst-=32;
473 2 for(i=0;i<32;i++)
474 2 {
475 3 FDTBuf.Buf[32*j+i]=*(pt+temp_ofst+i);
476 3 }
477 2 FDTBuf.FDTNum+=32;
478 2 j++;
479 2 }while(*(pt+temp_ofst)<0x40);
C51 COMPILER V8.02 U_FUNC_B 07/21/2008 09:40:01 PAGE 9
480 1
481 1 }
482
483
484 void WrFDT_a(unsigned long FirstClust)
485 {
486 1 unsigned char i,j,CtnsNum=0,SectOfst;
487 1 unsigned char xdata *pt;
488 1 unsigned int temp_ofst;
489 1 pt=Data_Buf;
*** WARNING C182 IN LINE 489 OF U_FUNC_B.C: pointer to different objects
490 1 FDTBuf.Buf[0x1a]=(unsigned char)FirstClust; //修改首簇号
491 1 FDTBuf.Buf[0x1b]=(unsigned char)(FirstClust>>8);
492 1 FDTBuf.Buf[0x14]=(unsigned char)(FirstClust>>16);
493 1 FDTBuf.Buf[0x15]=(unsigned char)(FirstClust>>24);
494 1 for(i=0;i<sect_clust_a;i++)
495 1 {
496 2 Rd_Sector_a(root_a+i);
497 2 temp_ofst=0;
498 2 for(j=0;j<16;j++)
499 2 {
500 3 if(*(pt+j*32)==0||*(pt+j*32)==0xe5)
501 3 CtnsNum++;
502 3 else CtnsNum=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -