📄 identify_mp3s.asm
字号:
/************************************************************************************************/
/* The following routine scans through the root directory sector by sector and checks for MP3s */
/* on the CF and saves off their name, start cluster, & file size. It also checks for long */
/* files names but currently is not supported. */
/* Last Modified 02-26-03. H. Desai */
/************************************************************************************************/
.GLOBAL Identify_MP3s;
.EXTERN Namearray;
.EXTERN MP3_Startclusters;
.EXTERN Filesize;
.EXTERN Root_Directory;
.EXTERN Parameters;
.EXTERN Read_Sector_CF;
.EXTERN Calc_CHS;
.EXTERN LF_Name;
.SECTION program;
/**Identify MP3s on CF**/
Identify_MP3s:
R7 = RETS;
P5 = [P1+0x8]; //Number of Root Directory Sectors to scan
P5 += -1; //Subtract 1 because we already loaded one
I1.H = Namearray;
I1.L = Namearray;
L1 = 0x0(Z);
P1.H = MP3_Startclusters;
P1.L = MP3_Startclusters;
P4.H = Filesize;
P4.L = Filesize;
P3.L = 0x20;
P3.H = 0x0;
R5 = 0xFF(Z);
R6 = 0xE5(Z); //E5 indicates free entry
LSETUP(search_root_dir_for_mp3s_BEGIN, search_root_dir_for_mp3s_END) LC0 = P5;
search_root_dir_for_mp3s_BEGIN: nop;
P5.H = 0x0000;
P5.L = 0x0010; //Scan through 16 dirctorys (512 bytes total) in each sector
P2.H = Root_Directory;
P2.L = Root_Directory;
LSETUP(identify_mp3_files_BEGIN, identify_mp3_files_END) LC1 = P5;
identify_mp3_files_BEGIN:
P5.H = Parameters;
P5.L = Parameters;
R0 = W[P2++P3](Z); //Increment by 16 words (32 bytes) to next directory
R0 = R0 & R5;
cc = R0 == R6;
IF !cc JUMP Not_Free_Entry;
IF cc JUMP Free_Entry;
Not_Free_Entry:
CALL check_for_mp3_file_ext;
JUMP identify_mp3_files_END;
Free_Entry:
CALL check_for_long_MP3filename;
identify_mp3_files_END: NOP;
R0 = [P5];
R0 += 1; //Increment to next sector in Root Directory
[P5] = R0;
R1 = [P5+0xC]; //# of Hidden Sectors
R0 = R0 + R1;
CALL Calc_CHS;
I0.H = Root_Directory;
I0.L = Root_Directory;
L0 = 0x0;
B0 = I0;
Call Read_Sector_CF; //Grab next sector in Root Directory
search_root_dir_for_mp3s_END: NOP;
NOP;
RETS = R7;
RTS;
/******************************************/
check_for_mp3_file_ext:
R0 = [P2-0x18];
R1.H = 0x00FF;
R1.L = 0xFFFF;
R0 = R0 & R1;
R1.H = 0x0033;
R1.L = 0x504D;
cc = R0 == R1; //check for MP3 extension = 0x4D5033
IF cc JUMP MP3_Detected;
RTS;
MP3_Detected:
Save_Name:
R0 = W[P2-0x20](Z);
W[I1++] = R0.L;
R0 = W[P2-0x1E](Z);
W[I1++] = R0.L;
R0 = W[P2-0x1C](Z);
W[I1++] = R0.L;
R0 = W[P2-0x1A](Z);
W[I1++] = R0.L;
Save_Starting_Cluster:
R0 = W[P2-0x6](Z);
W[P1++] = R0;
Save_Filesize:
R0 = W[P2-0x4](Z);
W[P4++] = R0;
R0 = W[P2-0x2](Z);
W[P4++] = R0;
R0 = [P5+0x28];
R0 += 1;
[P5+0x28] = R0; //Increment # of MP3 songs
RTS;
check_for_long_MP3filename:
R0 = B[P2-0x15](Z);
R1 = 0x0F;
cc = R0 == R1;
IF cc JUMP Long_File_Name;
RTS;
Long_File_Name:
R0 = W[P2-0x18](Z);
R1 = B[P2-0x16](Z);
R1 = R1 << 0X10;
R0 = R0 | R1;
R1.L = 0x504D;
R1.H = 0x0033;
cc = R0 == R1;
IF cc JUMP LF_Name_Detected;
RTS;
LF_Name_Detected:
P5.L = LF_Name;
P5.H = LF_Name;
R0 = B[P5];
R0 += 1;
B[P5] = R0;
RTS;
/******************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -