📄 mp3_player_06.lss
字号:
e2c: cd bf out 0x3d, r28 ; 61
e2e: 9b 01 movw r18, r22
/* lyric time tag struct pointer for process*/
struct LrcStruct_s * LrcStruct_p;
struct LrcStruct_s * LrcStruct_p_up, * LrcStruct_p_temp,* LrcStruct_p_down;
struct LrcStruct_s * LrcStruct_p_header;
uint16 lrcaddr; /* The address to store each lyric */
uint8 part; /* the sector number of one cluster */
uint16 i; /* loop variable for gerneral perpus */
uint16 j;
uint8 temp; /* temp variable */
uint8 * buffer; /* buffer pointer, later will use malloc to get the data area for it*/
uint16 min,sec,ms; /* temp variable for time tag process, minter, second, and milisecond */
uint8 sector; /* sector number to record current sector, with variable j to determine wether the file is ended*/
uint8 totalsect; /* total sectors the file contains */
uint16 leftbytes; /* how many data contained in the last sector */
uint32 p; /* cluster number of file, next ,etc */
uint8 mscnt; /* counter for ms, you konw 2.3 means 2300ms not 2003ms, so need this variable to determin this*/
LrcStructHead.header = (struct LrcStruct_s *)lrcbuffer; /* set lrc info struct 's header to the buffer */
e30: 61 e5 ldi r22, 0x51 ; 81
e32: 71 e0 ldi r23, 0x01 ; 1
e34: 70 93 d2 03 sts 0x03D2, r23
e38: 60 93 d1 03 sts 0x03D1, r22
#if FIX_DIRECTORY
if(SearchLrc(LRC_PATH,LongNameBuffer,&LrcInfo,isLongName)==0) /* search the path specified, and if found lyric file it will return 0*/
#else
if(SearchLrc(LRC_PATH,LongNameBuffer,&LrcInfo,music_record_addr,isLongName)==0) /* search the path specified, and if found lyric file it will return 0*/
e3c: 04 2f mov r16, r20
e3e: 46 e8 ldi r20, 0x86 ; 134
e40: 54 e0 ldi r21, 0x04 ; 4
e42: bc 01 movw r22, r24
e44: 80 e0 ldi r24, 0x00 ; 0
e46: 91 e0 ldi r25, 0x01 ; 1
e48: 0e 94 63 22 call 0x44c6 ; 0x44c6 <SearchLrc>
e4c: 88 23 and r24, r24
e4e: 09 f0 breq .+2 ; 0xe52 <LrcProc+0x58>
e50: 2e c4 rjmp .+2140 ; 0x16ae <__stack+0x5af>
#endif
{
// printf_P(PSTR("\r\n\r\n*****************************************************"));
// printf_P(PSTR("\r\nFound LRC file!"));
// printf_P(PSTR("\r\n\r\nAnalyzing LRC file ...........\r\n"));
lrc = 1; /* Set the flag */
e52: 81 e0 ldi r24, 0x01 ; 1
e54: 80 93 4a 01 sts 0x014A, r24
lrcaddr = 0; /* Clear the address */
LrcStruct_p = LrcStructHead.header; /* intialize the sigle direction node */
e58: a0 91 d1 03 lds r26, 0x03D1
e5c: b0 91 d2 03 lds r27, 0x03D2
e60: fd 01 movw r30, r26
e62: 20 e0 ldi r18, 0x00 ; 0
e64: 30 e0 ldi r19, 0x00 ; 0
for(i=0;i<MAXITEM-1;i++)
{
LrcStruct_p->next = LrcStruct_p + 1;
e66: cf 01 movw r24, r30
e68: 08 96 adiw r24, 0x08 ; 8
e6a: 91 83 std Z+1, r25 ; 0x01
e6c: 80 83 st Z, r24
e6e: 2f 5f subi r18, 0xFF ; 255
e70: 3f 4f sbci r19, 0xFF ; 255
e72: fc 01 movw r30, r24
e74: 2f 34 cpi r18, 0x4F ; 79
e76: 31 05 cpc r19, r1
e78: b1 f7 brne .-20 ; 0xe66 <LrcProc+0x6c>
LrcStruct_p = LrcStruct_p->next;
}
LrcStruct_p->next = 0;
e7a: a8 58 subi r26, 0x88 ; 136
e7c: bd 4f sbci r27, 0xFD ; 253
e7e: 1d 92 st X+, r1
e80: 1c 92 st X, r1
LrcStruct_p = LrcStructHead.header;
e82: 20 91 d1 03 lds r18, 0x03D1
e86: 30 91 d2 03 lds r19, 0x03D2
e8a: 3c 83 std Y+4, r19 ; 0x04
e8c: 2b 83 std Y+3, r18 ; 0x03
LrcStructHead.offset = 0; /* clear the lyc info struct */
e8e: 10 92 04 04 sts 0x0404, r1
e92: 10 92 03 04 sts 0x0403, r1
LrcStructHead.title[0] = '\0';
e96: 10 92 d3 03 sts 0x03D3, r1
LrcStructHead.artist[0] = '\0';
e9a: 10 92 f3 03 sts 0x03F3, r1
buffer = malloc(520); /* allocate memory for read the lyric file */
e9e: 88 e0 ldi r24, 0x08 ; 8
ea0: 92 e0 ldi r25, 0x02 ; 2
ea2: 0e 94 67 3f call 0x7ece ; 0x7ece <malloc>
ea6: 4c 01 movw r8, r24
if(buffer==0)
ea8: 89 2b or r24, r25
eaa: 09 f4 brne .+2 ; 0xeae <LrcProc+0xb4>
eac: 06 c4 rjmp .+2060 ; 0x16ba <__stack+0x5bb>
{
#if DEBUG
printf_P(PSTR("\r\nERROR: No enough memory!"));
#endif
return 1;
}
p = LrcInfo.deStartCluster+(((unsigned long)LrcInfo.deHighClust)<<16); /* Calculate the first cluster of the lyric file */
eae: 80 91 a0 04 lds r24, 0x04A0
eb2: 90 91 a1 04 lds r25, 0x04A1
eb6: 7c 01 movw r14, r24
eb8: 00 27 eor r16, r16
eba: 11 27 eor r17, r17
ebc: 80 91 9a 04 lds r24, 0x049A
ec0: 90 91 9b 04 lds r25, 0x049B
ec4: aa 27 eor r26, r26
ec6: bb 27 eor r27, r27
ec8: dc 01 movw r26, r24
eca: 99 27 eor r25, r25
ecc: 88 27 eor r24, r24
ece: e8 0e add r14, r24
ed0: f9 1e adc r15, r25
ed2: 0a 1f adc r16, r26
ed4: 1b 1f adc r17, r27
totalsect = LrcInfo.deFileSize/512; /*计算扇区数 //calculate the total sectors */
ed6: 20 91 a2 04 lds r18, 0x04A2
eda: 30 91 a3 04 lds r19, 0x04A3
ede: 40 91 a4 04 lds r20, 0x04A4
ee2: 50 91 a5 04 lds r21, 0x04A5
ee6: da 01 movw r26, r20
ee8: c9 01 movw r24, r18
eea: 49 e0 ldi r20, 0x09 ; 9
eec: b6 95 lsr r27
eee: a7 95 ror r26
ef0: 97 95 ror r25
ef2: 87 95 ror r24
ef4: 4a 95 dec r20
ef6: d1 f7 brne .-12 ; 0xeec <LrcProc+0xf2>
ef8: 88 87 std Y+8, r24 ; 0x08
leftbytes = LrcInfo.deFileSize%512; /*计算剩余的字节数 //calculate the left bytes */
efa: 31 70 andi r19, 0x01 ; 1
efc: 3f 83 std Y+7, r19 ; 0x07
efe: 2e 83 std Y+6, r18 ; 0x06
f00: 22 24 eor r2, r2
f02: 33 24 eor r3, r3
f04: 19 86 std Y+9, r1 ; 0x09
f06: 1a 86 std Y+10, r1 ; 0x0a
f08: 37 c3 rjmp .+1646 ; 0x1578 <__stack+0x479>
sector=0; /* clear the sector counter */
/* here to start analyze the lyric file */
while(1)
{
for(part=0;part<SectorsPerClust;part++) /* first loop for read a sector of a culster */
{
if(FAT_LoadPartCluster(p,part,buffer))
{
#if DEBUG
printf_P(PSTR("\r\nERROR: Failed to read one sector"));
#endif
free(buffer);
return 1;
}
for(j=0;j<512;) /* second loop for analyze each byte of the sector */
{
if(sector == totalsect && j == leftbytes) /* see if it is the end of file */
{
part = SectorsPerClust; /* next loop it will get out */
f0a: 30 91 5a 07 lds r19, 0x075A
f0e: 3a 87 std Y+10, r19 ; 0x0a
f10: 2d c3 rjmp .+1626 ; 0x156c <__stack+0x46d>
f12: 94 01 movw r18, r8
f14: c8 01 movw r24, r16
f16: b7 01 movw r22, r14
f18: 0e 94 42 14 call 0x2884 ; 0x2884 <FAT_LoadPartCluster>
f1c: 88 23 and r24, r24
f1e: 09 f0 breq .+2 ; 0xf22 <LrcProc+0x128>
f20: c9 c3 rjmp .+1938 ; 0x16b4 <__stack+0x5b5>
f22: aa 24 eor r10, r10
f24: bb 24 eor r11, r11
f26: 69 85 ldd r22, Y+9 ; 0x09
f28: 78 85 ldd r23, Y+8 ; 0x08
f2a: 67 17 cp r22, r23
f2c: 29 f4 brne .+10 ; 0xf38 <LrcProc+0x13e>
f2e: 8e 81 ldd r24, Y+6 ; 0x06
f30: 9f 81 ldd r25, Y+7 ; 0x07
f32: a8 16 cp r10, r24
f34: b9 06 cpc r11, r25
f36: 49 f3 breq .-46 ; 0xf0a <LrcProc+0x110>
break;
}
if(buffer[j] == '[') /* if it is the "[" : the tag start */
f38: 34 01 movw r6, r8
f3a: 6a 0c add r6, r10
f3c: 7b 1c adc r7, r11
f3e: d3 01 movw r26, r6
f40: 8c 91 ld r24, X
f42: 8b 35 cpi r24, 0x5B ; 91
f44: 09 f0 breq .+2 ; 0xf48 <LrcProc+0x14e>
f46: 09 c3 rjmp .+1554 ; 0x155a <__stack+0x45b>
{
#if DEBUG
printf_P(PSTR("\r\nfound tag start ["));
#endif
/**********************************************************************************************************/
i = 0;
if(strcomp_noncase("TI:",&buffer[j+1])) /* string compare to check if this is a title tag */
f48: 63 01 movw r12, r6
f4a: 08 94 sec
f4c: c1 1c adc r12, r1
f4e: d1 1c adc r13, r1
f50: b6 01 movw r22, r12
f52: 85 e0 ldi r24, 0x05 ; 5
f54: 91 e0 ldi r25, 0x01 ; 1
f56: 0e 94 e5 06 call 0xdca ; 0xdca <strcomp_noncase>
f5a: 88 23 and r24, r24
f5c: 19 f1 breq .+70 ; 0xfa4 <LrcProc+0x1aa>
{
j+=4; /* count add 4 */
f5e: e4 e0 ldi r30, 0x04 ; 4
f60: f0 e0 ldi r31, 0x00 ; 0
f62: ae 0e add r10, r30
f64: bf 1e adc r11, r31
f66: a3 01 movw r20, r6
f68: a0 e0 ldi r26, 0x00 ; 0
f6a: b0 e0 ldi r27, 0x00 ; 0
f6c: 23 ed ldi r18, 0xD3 ; 211
f6e: 33 e0 ldi r19, 0x03 ; 3
while(1) /* store the title */
{
temp = buffer[j++];
f70: fa 01 movw r30, r20
f72: 84 81 ldd r24, Z+4 ; 0x04
f74: 08 94 sec
f76: a1 1c adc r10, r1
f78: b1 1c adc r11, r1
if(temp == 0x0d || temp == 0x0a || temp == ']' || i> (TI_LEN - 2)) /* title ended */
f7a: 8d 30 cpi r24, 0x0D ; 13
f7c: 71 f0 breq .+28 ; 0xf9a <LrcProc+0x1a0>
f7e: 8a 30 cpi r24, 0x0A ; 10
f80: 61 f0 breq .+24 ; 0xf9a <LrcProc+0x1a0>
f82: 8d 35 cpi r24, 0x5D ; 93
f84: 51 f0 breq .+20 ; 0xf9a <LrcProc+0x1a0>
f86: 4f 5f subi r20, 0xFF ; 255
f88: 5f 4f sbci r21, 0xFF ; 255
f8a: af 31 cpi r26, 0x1F ; 31
f8c: b1 05 cpc r27, r1
f8e: 29 f0 breq .+10 ; 0xf9a <LrcProc+0x1a0>
break;
LrcStructHead.title[i++] = temp;
f90: f9 01 movw r30, r18
f92: 81 93 st Z+, r24
f94: 9f 01 movw r18, r30
f96: 11 96 adiw r26, 0x01 ; 1
f98: eb cf rjmp .-42 ; 0xf70 <LrcProc+0x176>
}
LrcStructHead.title[i] = 0; /* need a 0 to end the string */
f9a: af 52 subi r26, 0x2F ; 47
f9c: bc 4f sbci r27, 0xFC ; 252
f9e: fd 01 movw r30, r26
fa0: 12 82 std Z+2, r1 ; 0x02
fa2: de c2 rjmp .+1468 ; 0x1560 <__stack+0x461>
#if DEBUG
printf_P(PSTR(" found title tag: %s ]"),LrcStructHead.title);
#else
// printf_P(PSTR("\r\nTitle : %s "),LrcStructHead.title);
#endif
}
/**********************************************************************************************************/
else if(strcomp_noncase("AR:",&buffer[j+1])) /* string compare to check if this is a artist tag */
fa4: b6 01 movw r22, r12
fa6: 89 e0 ldi r24, 0x09 ; 9
fa8: 91 e0 ldi r25, 0x01 ; 1
faa: 0e 94 e5 06 call 0xdca ; 0xdca <strcomp_noncase>
fae: 88 23 and r24, r24
fb0: 19 f1 breq .+70 ; 0xff8 <LrcProc+0x1fe>
{
j+=4; /* count += 4 */
fb2: 24 e0 ldi r18, 0x04 ; 4
fb4: 30 e0 ldi r19, 0x00 ; 0
fb6: a2 0e add r10, r18
fb8: b3 1e adc r11, r19
fba: a3 01 movw r20, r6
fbc: a0 e0 ldi r26, 0x00 ; 0
fbe: b0 e0 ldi r27, 0x00 ; 0
fc0: 23 ef ldi r18, 0xF3 ; 243
fc2: 33 e0 ldi r19, 0x03 ; 3
while(1) /* store the content */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -