⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp3_player_06.lss

📁 基于ATmega64单片机以及vs1003的SD卡方案的MP3播放源代码
💻 LSS
📖 第 1 页 / 共 5 页
字号:
    15b4:	cd bf       	out	0x3d, r28	; 61
    15b6:	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 */
    15b8:	47 e6       	ldi	r20, 0x67	; 103
    15ba:	51 e0       	ldi	r21, 0x01	; 1
    15bc:	50 93 e8 03 	sts	0x03E8, r21
    15c0:	40 93 e7 03 	sts	0x03E7, r20

#if FIX_DIRECTORY
	if(SearchLrc(LRC_PATH,LongNameBuffer,&LrcInfo)==0)	/* search the path specified, and if found lyric file it will return 0*/
#else
	if(SearchLrc(LRC_PATH,LongNameBuffer,&LrcInfo,music_record_addr)==0)	/* search the path specified, and if found lyric file it will return 0*/
    15c4:	4c e9       	ldi	r20, 0x9C	; 156
    15c6:	54 e0       	ldi	r21, 0x04	; 4
    15c8:	bc 01       	movw	r22, r24
    15ca:	80 e0       	ldi	r24, 0x00	; 0
    15cc:	91 e0       	ldi	r25, 0x01	; 1
    15ce:	0e 94 d9 29 	call	0x53b2	; 0x53b2 <SearchLrc>
    15d2:	88 23       	and	r24, r24
    15d4:	09 f0       	breq	.+2      	; 0x15d8 <LrcProc+0x56>
    15d6:	b1 c4       	rjmp	.+2402   	; 0x1f3a <LrcProc+0x9b8>
#endif
	{ 
		printf_P(PSTR("\r\n\r\n*****************************************************"));
    15d8:	8b ef       	ldi	r24, 0xFB	; 251
    15da:	98 e0       	ldi	r25, 0x08	; 8
    15dc:	9f 93       	push	r25
    15de:	8f 93       	push	r24
    15e0:	0e 94 96 48 	call	0x912c	; 0x912c <printf_P>
		printf_P(PSTR("\r\nFound LRC file!"));
    15e4:	89 ee       	ldi	r24, 0xE9	; 233
    15e6:	98 e0       	ldi	r25, 0x08	; 8
    15e8:	9f 93       	push	r25
    15ea:	8f 93       	push	r24
    15ec:	0e 94 96 48 	call	0x912c	; 0x912c <printf_P>
		printf_P(PSTR("\r\n\r\nAnalyzing LRC file ...........\r\n"));
    15f0:	84 ec       	ldi	r24, 0xC4	; 196
    15f2:	98 e0       	ldi	r25, 0x08	; 8
    15f4:	9f 93       	push	r25
    15f6:	8f 93       	push	r24
    15f8:	0e 94 96 48 	call	0x912c	; 0x912c <printf_P>
	   
		lrc = 1;								/* Set the flag */
    15fc:	81 e0       	ldi	r24, 0x01	; 1
    15fe:	80 93 60 01 	sts	0x0160, r24
		lrcaddr = 0;							/* Clear the address */
	   
		LrcStruct_p = LrcStructHead.header;		/* intialize the sigle direction node */
    1602:	a0 91 e7 03 	lds	r26, 0x03E7
    1606:	b0 91 e8 03 	lds	r27, 0x03E8
    160a:	fd 01       	movw	r30, r26
    160c:	20 e0       	ldi	r18, 0x00	; 0
    160e:	30 e0       	ldi	r19, 0x00	; 0
    1610:	6d b7       	in	r22, 0x3d	; 61
    1612:	7e b7       	in	r23, 0x3e	; 62
    1614:	6a 5f       	subi	r22, 0xFA	; 250
    1616:	7f 4f       	sbci	r23, 0xFF	; 255
    1618:	0f b6       	in	r0, 0x3f	; 63
    161a:	f8 94       	cli
    161c:	7e bf       	out	0x3e, r23	; 62
    161e:	0f be       	out	0x3f, r0	; 63
    1620:	6d bf       	out	0x3d, r22	; 61
		for(i=0;i<MAXITEM-1;i++)
		{
			LrcStruct_p->next = LrcStruct_p + 1;
    1622:	cf 01       	movw	r24, r30
    1624:	08 96       	adiw	r24, 0x08	; 8
    1626:	91 83       	std	Z+1, r25	; 0x01
    1628:	80 83       	st	Z, r24
    162a:	2f 5f       	subi	r18, 0xFF	; 255
    162c:	3f 4f       	sbci	r19, 0xFF	; 255
    162e:	fc 01       	movw	r30, r24
    1630:	2f 34       	cpi	r18, 0x4F	; 79
    1632:	31 05       	cpc	r19, r1
    1634:	b1 f7       	brne	.-20     	; 0x1622 <LrcProc+0xa0>
			LrcStruct_p = LrcStruct_p->next;
		}
		LrcStruct_p->next = 0;
    1636:	a8 58       	subi	r26, 0x88	; 136
    1638:	bd 4f       	sbci	r27, 0xFD	; 253
    163a:	1d 92       	st	X+, r1
    163c:	1c 92       	st	X, r1
		LrcStruct_p = LrcStructHead.header;
    163e:	80 91 e7 03 	lds	r24, 0x03E7
    1642:	90 91 e8 03 	lds	r25, 0x03E8
    1646:	9c 83       	std	Y+4, r25	; 0x04
    1648:	8b 83       	std	Y+3, r24	; 0x03
								  
		LrcStructHead.offset = 0;				/* clear the lyc info struct */
    164a:	10 92 1a 04 	sts	0x041A, r1
    164e:	10 92 19 04 	sts	0x0419, r1
		LrcStructHead.title[0] = '\0';
    1652:	10 92 e9 03 	sts	0x03E9, r1
		LrcStructHead.artist[0] = '\0';
    1656:	10 92 09 04 	sts	0x0409, r1
	   
		buffer = malloc(520);					/* allocate memory for read the lyric file */
    165a:	88 e0       	ldi	r24, 0x08	; 8
    165c:	92 e0       	ldi	r25, 0x02	; 2
    165e:	0e 94 d8 46 	call	0x8db0	; 0x8db0 <malloc>
    1662:	4c 01       	movw	r8, r24
		if(buffer==0)
    1664:	89 2b       	or	r24, r25
    1666:	09 f4       	brne	.+2      	; 0x166a <LrcProc+0xe8>
    1668:	6e c4       	rjmp	.+2268   	; 0x1f46 <LrcProc+0x9c4>
		{
			#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 */
    166a:	80 91 b6 04 	lds	r24, 0x04B6
    166e:	90 91 b7 04 	lds	r25, 0x04B7
    1672:	7c 01       	movw	r14, r24
    1674:	00 27       	eor	r16, r16
    1676:	11 27       	eor	r17, r17
    1678:	80 91 b0 04 	lds	r24, 0x04B0
    167c:	90 91 b1 04 	lds	r25, 0x04B1
    1680:	aa 27       	eor	r26, r26
    1682:	bb 27       	eor	r27, r27
    1684:	dc 01       	movw	r26, r24
    1686:	99 27       	eor	r25, r25
    1688:	88 27       	eor	r24, r24
    168a:	e8 0e       	add	r14, r24
    168c:	f9 1e       	adc	r15, r25
    168e:	0a 1f       	adc	r16, r26
    1690:	1b 1f       	adc	r17, r27
		totalsect = LrcInfo.deFileSize/512; /*计算扇区数			//calculate the total sectors */
    1692:	20 91 b8 04 	lds	r18, 0x04B8
    1696:	30 91 b9 04 	lds	r19, 0x04B9
    169a:	40 91 ba 04 	lds	r20, 0x04BA
    169e:	50 91 bb 04 	lds	r21, 0x04BB
    16a2:	da 01       	movw	r26, r20
    16a4:	c9 01       	movw	r24, r18
    16a6:	49 e0       	ldi	r20, 0x09	; 9
    16a8:	b6 95       	lsr	r27
    16aa:	a7 95       	ror	r26
    16ac:	97 95       	ror	r25
    16ae:	87 95       	ror	r24
    16b0:	4a 95       	dec	r20
    16b2:	d1 f7       	brne	.-12     	; 0x16a8 <LrcProc+0x126>
    16b4:	88 87       	std	Y+8, r24	; 0x08
		leftbytes = LrcInfo.deFileSize%512; /*计算剩余的字节数	//calculate the left bytes */	
    16b6:	31 70       	andi	r19, 0x01	; 1
    16b8:	3f 83       	std	Y+7, r19	; 0x07
    16ba:	2e 83       	std	Y+6, r18	; 0x06
    16bc:	22 24       	eor	r2, r2
    16be:	33 24       	eor	r3, r3
    16c0:	19 86       	std	Y+9, r1	; 0x09
    16c2:	1a 86       	std	Y+10, r1	; 0x0a
    16c4:	7d c3       	rjmp	.+1786   	; 0x1dc0 <LrcProc+0x83e>
		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 */
    16c6:	90 91 70 07 	lds	r25, 0x0770
    16ca:	9a 87       	std	Y+10, r25	; 0x0a
    16cc:	73 c3       	rjmp	.+1766   	; 0x1db4 <LrcProc+0x832>
    16ce:	94 01       	movw	r18, r8
    16d0:	c8 01       	movw	r24, r16
    16d2:	b7 01       	movw	r22, r14
    16d4:	0e 94 b8 1b 	call	0x3770	; 0x3770 <FAT_LoadPartCluster>
    16d8:	88 23       	and	r24, r24
    16da:	09 f0       	breq	.+2      	; 0x16de <LrcProc+0x15c>
    16dc:	31 c4       	rjmp	.+2146   	; 0x1f40 <LrcProc+0x9be>
    16de:	aa 24       	eor	r10, r10
    16e0:	bb 24       	eor	r11, r11
    16e2:	a9 85       	ldd	r26, Y+9	; 0x09
    16e4:	b8 85       	ldd	r27, Y+8	; 0x08
    16e6:	ab 17       	cp	r26, r27
    16e8:	29 f4       	brne	.+10     	; 0x16f4 <LrcProc+0x172>
    16ea:	ee 81       	ldd	r30, Y+6	; 0x06
    16ec:	ff 81       	ldd	r31, Y+7	; 0x07
    16ee:	ae 16       	cp	r10, r30
    16f0:	bf 06       	cpc	r11, r31
    16f2:	49 f3       	breq	.-46     	; 0x16c6 <LrcProc+0x144>
						break;
					}
					if(buffer[j] == '[')			/* if it is the "[" : the tag start */
    16f4:	64 01       	movw	r12, r8
    16f6:	ca 0c       	add	r12, r10
    16f8:	db 1c       	adc	r13, r11
    16fa:	d6 01       	movw	r26, r12
    16fc:	8c 91       	ld	r24, X
    16fe:	8b 35       	cpi	r24, 0x5B	; 91
    1700:	09 f0       	breq	.+2      	; 0x1704 <LrcProc+0x182>
    1702:	4f c3       	rjmp	.+1694   	; 0x1da2 <LrcProc+0x820>
					{
						#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 */
    1704:	36 01       	movw	r6, r12
    1706:	08 94       	sec
    1708:	61 1c       	adc	r6, r1
    170a:	71 1c       	adc	r7, r1
    170c:	b3 01       	movw	r22, r6
    170e:	85 e0       	ldi	r24, 0x05	; 5
    1710:	91 e0       	ldi	r25, 0x01	; 1
    1712:	0e 94 a9 0a 	call	0x1552	; 0x1552 <strcomp_noncase>
    1716:	88 23       	and	r24, r24
    1718:	49 f1       	breq	.+82     	; 0x176c <LrcProc+0x1ea>
						{
							j+=4;		/* count add 4 */
    171a:	e4 e0       	ldi	r30, 0x04	; 4
    171c:	f0 e0       	ldi	r31, 0x00	; 0
    171e:	ae 0e       	add	r10, r30
    1720:	bf 1e       	adc	r11, r31
    1722:	a6 01       	movw	r20, r12
    1724:	a0 e0       	ldi	r26, 0x00	; 0
    1726:	b0 e0       	ldi	r27, 0x00	; 0
    1728:	29 ee       	ldi	r18, 0xE9	; 233
    172a:	33 e0       	ldi	r19, 0x03	; 3
							while(1)		/* store the title */
							{
								temp = buffer[j++];
    172c:	fa 01       	movw	r30, r20
    172e:	84 81       	ldd	r24, Z+4	; 0x04
    1730:	08 94       	sec
    1732:	a1 1c       	adc	r10, r1
    1734:	b1 1c       	adc	r11, r1
								if(temp == 0x0d || temp == 0x0a || temp == ']' || i> (TI_LEN - 2)) /* title ended */
    1736:	8d 30       	cpi	r24, 0x0D	; 13
    1738:	71 f0       	breq	.+28     	; 0x1756 <LrcProc+0x1d4>
    173a:	8a 30       	cpi	r24, 0x0A	; 10
    173c:	61 f0       	breq	.+24     	; 0x1756 <LrcProc+0x1d4>
    173e:	8d 35       	cpi	r24, 0x5D	; 93
    1740:	51 f0       	breq	.+20     	; 0x1756 <LrcProc+0x1d4>
    1742:	4f 5f       	subi	r20, 0xFF	; 255
    1744:	5f 4f       	sbci	r21, 0xFF	; 255
    1746:	af 31       	cpi	r26, 0x1F	; 31
    1748:	b1 05       	cpc	r27, r1
    174a:	29 f0       	breq	.+10     	; 0x1756 <LrcProc+0x1d4>
									break;
								LrcStructHead.title[i++] = temp;
    174c:	f9 01       	movw	r30, r18
    174e:	81 93       	st	Z+, r24
    1750:	9f 01       	movw	r18, r30
    1752:	11 96       	adiw	r26, 0x01	; 1
    1754:	eb cf       	rjmp	.-42     	; 0x172c <LrcProc+0x1aa>
							}
							LrcStructHead.title[i] = 0;	/* need a 0 to end the string */
    1756:	a9 51       	subi	r26, 0x19	; 25
    1758:	bc 4f       	sbci	r27, 0xFC	; 252
    175a:	fd 01       	movw	r30, r26

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -