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

📄 mp3_player_06.lss

📁 MP3源码 内有SD2.0 驱动 FAT32 驱动
💻 LSS
📖 第 1 页 / 共 5 页
字号:
     eca:	0e 94 a0 2b 	call	0x5740	; 0x5740 <lcdClrDisBuf>
	LCD_print12_P(0,0,PSTR("Pls insert SD card!"));
     ece:	4a e2       	ldi	r20, 0x2A	; 42
     ed0:	51 e0       	ldi	r21, 0x01	; 1
     ed2:	60 e0       	ldi	r22, 0x00	; 0
     ed4:	70 e0       	ldi	r23, 0x00	; 0
     ed6:	80 e0       	ldi	r24, 0x00	; 0
     ed8:	90 e0       	ldi	r25, 0x00	; 0
     eda:	0e 94 e0 2f 	call	0x5fc0	; 0x5fc0 <LCD_print12_P>
	lcdUpdateDisplay();
     ede:	0e 94 a8 2b 	call	0x5750	; 0x5750 <lcdUpdateDisplay>
	while(MMC_SD_Init());
     ee2:	0e 94 e6 24 	call	0x49cc	; 0x49cc <MMC_SD_Init>
     ee6:	88 23       	and	r24, r24
     ee8:	e1 f7       	brne	.-8      	; 0xee2 <main+0x72>
	
	FAT_ReadSector = MMC_SD_ReadSingleBlock;//device read
     eea:	8f e8       	ldi	r24, 0x8F	; 143
     eec:	94 e2       	ldi	r25, 0x24	; 36
     eee:	90 93 cc 01 	sts	0x01CC, r25
     ef2:	80 93 cb 01 	sts	0x01CB, r24
	FAT_WriteSector = MMC_SD_WriteSingleBlock;//device write
     ef6:	88 e1       	ldi	r24, 0x18	; 24
     ef8:	94 e2       	ldi	r25, 0x24	; 36
     efa:	90 93 56 01 	sts	0x0156, r25
     efe:	80 93 55 01 	sts	0x0155, r24
	FAT_ReadCapacity = MMC_SD_ReadCapacity;//read capacity
     f02:	84 e4       	ldi	r24, 0x44	; 68
     f04:	93 e2       	ldi	r25, 0x23	; 35
     f06:	90 93 b6 01 	sts	0x01B6, r25
     f0a:	80 93 b5 01 	sts	0x01B5, r24


	if(FAT_Init())
     f0e:	0e 94 4b 21 	call	0x4296	; 0x4296 <FAT_Init>
     f12:	88 23       	and	r24, r24
     f14:	69 f0       	breq	.+26     	; 0xf30 <main+0xc0>
	{
		lcdClrDisBuf();
     f16:	0e 94 a0 2b 	call	0x5740	; 0x5740 <lcdClrDisBuf>
		LCD_print12_P(0,0,PSTR("Wrong FAT!\nSystem halted!\nPls reset the\nsystem! -bozai"));
     f1a:	43 ef       	ldi	r20, 0xF3	; 243
     f1c:	50 e0       	ldi	r21, 0x00	; 0
     f1e:	60 e0       	ldi	r22, 0x00	; 0
     f20:	70 e0       	ldi	r23, 0x00	; 0
     f22:	80 e0       	ldi	r24, 0x00	; 0
     f24:	90 e0       	ldi	r25, 0x00	; 0
     f26:	0e 94 e0 2f 	call	0x5fc0	; 0x5fc0 <LCD_print12_P>
		lcdUpdateDisplay();
     f2a:	0e 94 a8 2b 	call	0x5750	; 0x5750 <lcdUpdateDisplay>
     f2e:	ff cf       	rjmp	.-2      	; 0xf2e <main+0xbe>
		while(1);
	}//初始化FAT文件系统
		
	if(GBK_Ini())
     f30:	0e 94 cf 2a 	call	0x559e	; 0x559e <GBK_Ini>
     f34:	88 23       	and	r24, r24
     f36:	79 f0       	breq	.+30     	; 0xf56 <main+0xe6>
	{
		lcdClrDisBuf();
     f38:	0e 94 a0 2b 	call	0x5740	; 0x5740 <lcdClrDisBuf>
		LCD_print12_P(0,0,PSTR("Firmware lost!\nPress start to\ncontinue!\n    --By bozai"));
     f3c:	4c eb       	ldi	r20, 0xBC	; 188
     f3e:	50 e0       	ldi	r21, 0x00	; 0
     f40:	60 e0       	ldi	r22, 0x00	; 0
     f42:	70 e0       	ldi	r23, 0x00	; 0
     f44:	80 e0       	ldi	r24, 0x00	; 0
     f46:	90 e0       	ldi	r25, 0x00	; 0
     f48:	0e 94 e0 2f 	call	0x5fc0	; 0x5fc0 <LCD_print12_P>
		lcdUpdateDisplay();
     f4c:	0e 94 a8 2b 	call	0x5750	; 0x5750 <lcdUpdateDisplay>
		HanziEnable = 0;
     f50:	10 92 4e 01 	sts	0x014E, r1
     f54:	0f c0       	rjmp	.+30     	; 0xf74 <main+0x104>
	}
	else 
	{
		lcdClrDisBuf();
     f56:	0e 94 a0 2b 	call	0x5740	; 0x5740 <lcdClrDisBuf>
		//LCD_print12_P(0,0,PSTR("  固件正常!\n MP3 for 叶敏\n -- by 章其波\n 按开始键继续"));
		LCD_print12_P(0,0,PSTR("固件正常!\nMP3 player\n --by 章其波\n按开始键继续"));
     f5a:	4c e8       	ldi	r20, 0x8C	; 140
     f5c:	50 e0       	ldi	r21, 0x00	; 0
     f5e:	60 e0       	ldi	r22, 0x00	; 0
     f60:	70 e0       	ldi	r23, 0x00	; 0
     f62:	80 e0       	ldi	r24, 0x00	; 0
     f64:	90 e0       	ldi	r25, 0x00	; 0
     f66:	0e 94 e0 2f 	call	0x5fc0	; 0x5fc0 <LCD_print12_P>
		lcdUpdateDisplay();
     f6a:	0e 94 a8 2b 	call	0x5750	; 0x5750 <lcdUpdateDisplay>
             
		HanziEnable = 1;
     f6e:	81 e0       	ldi	r24, 0x01	; 1
     f70:	80 93 4e 01 	sts	0x014E, r24
	}


	while(1)
	{
		if(key_value & KEY_VALID)
     f74:	80 91 53 01 	lds	r24, 0x0153
     f78:	84 ff       	sbrs	r24, 4
     f7a:	fc cf       	rjmp	.-8      	; 0xf74 <main+0x104>
		{
		#if STOP_KEY
			if((key_value&KEY_VALUE_MASK) == KEY_STOP)
     f7c:	80 91 53 01 	lds	r24, 0x0153
     f80:	99 27       	eor	r25, r25
     f82:	8f 70       	andi	r24, 0x0F	; 15
     f84:	90 70       	andi	r25, 0x00	; 0
     f86:	89 2b       	or	r24, r25
     f88:	21 f0       	breq	.+8      	; 0xf92 <main+0x122>
		#else
			if((key_value&KEY_VALUE_MASK) == KEY_MODE)
		#endif
			{
				key_value = 0;
				break;
			}
			else key_value = 0;
     f8a:	10 92 53 01 	sts	0x0153, r1
     f8e:	f2 cf       	rjmp	.-28     	; 0xf74 <main+0x104>
     f90:	ff cf       	rjmp	.-2      	; 0xf90 <main+0x120>
     f92:	10 92 53 01 	sts	0x0153, r1
		}
	}


	
#if FIX_DIRECTORY
	//printf_P(PSTR("\r\nSearch the folder %s\r\n"),MUSIC_PATH);
	Search(MUSIC_PATH,&MusicInfo,&totalsongs,&type);//搜索歌曲
#else
	//printf_P(PSTR("\r\n\r\nSearch & record folder information....."));
	//printf_P(PSTR("\r\nNOTE: MAX folder amount is %d for we only use %dBytes EEPROM to store the info\r\n"),(RECORD_ADDR_END-RECORD_ADDR_START)/4 -1,RECORD_ADDR_END-RECORD_ADDR_START);
	SearchInit();
     f96:	0e 94 61 0f 	call	0x1ec2	; 0x1ec2 <SearchInit>
	Search(0,&MusicInfo,&totalsongs,&type);//搜索歌曲
     f9a:	23 e0       	ldi	r18, 0x03	; 3
     f9c:	34 e0       	ldi	r19, 0x04	; 4
     f9e:	44 e0       	ldi	r20, 0x04	; 4
     fa0:	54 e0       	ldi	r21, 0x04	; 4
     fa2:	66 e8       	ldi	r22, 0x86	; 134
     fa4:	74 e0       	ldi	r23, 0x04	; 4
     fa6:	80 e0       	ldi	r24, 0x00	; 0
     fa8:	90 e0       	ldi	r25, 0x00	; 0
     faa:	0e 94 74 0b 	call	0x16e8	; 0x16e8 <Search>
#endif

	PlayMusicwithKey();
     fae:	0e 94 05 36 	call	0x6c0a	; 0x6c0a <PlayMusicwithKey>
     fb2:	ee cf       	rjmp	.-36     	; 0xf90 <main+0x120>

00000fb4 <FAT_LoadPartCluster>:
}

//读一个簇中的一个扇区
unsigned char FAT_LoadPartCluster(unsigned long cluster,unsigned part,BYTE * buffer)
{
     fb4:	cf 92       	push	r12
     fb6:	df 92       	push	r13
     fb8:	ef 92       	push	r14
     fba:	ff 92       	push	r15
     fbc:	0f 93       	push	r16
     fbe:	1f 93       	push	r17
     fc0:	7a 01       	movw	r14, r20
     fc2:	69 01       	movw	r12, r18
	DWORD sector;
	sector=(DWORD)FirstDataSector+(DWORD)(cluster-2)*(DWORD)SectorsPerClust;//calculate the actual sector number
	if(FAT_ReadSector(sector+part,buffer))return 1;
     fc4:	62 50       	subi	r22, 0x02	; 2
     fc6:	70 40       	sbci	r23, 0x00	; 0
     fc8:	80 40       	sbci	r24, 0x00	; 0
     fca:	90 40       	sbci	r25, 0x00	; 0
     fcc:	20 91 5f 01 	lds	r18, 0x015F
     fd0:	30 91 60 01 	lds	r19, 0x0160
     fd4:	44 27       	eor	r20, r20
     fd6:	55 27       	eor	r21, r21
     fd8:	0e 94 58 46 	call	0x8cb0	; 0x8cb0 <__mulsi3>
     fdc:	20 91 61 01 	lds	r18, 0x0161
     fe0:	30 91 62 01 	lds	r19, 0x0162
     fe4:	40 91 63 01 	lds	r20, 0x0163
     fe8:	50 91 64 01 	lds	r21, 0x0164
     fec:	26 0f       	add	r18, r22
     fee:	37 1f       	adc	r19, r23
     ff0:	48 1f       	adc	r20, r24
     ff2:	59 1f       	adc	r21, r25
     ff4:	00 27       	eor	r16, r16
     ff6:	11 27       	eor	r17, r17
     ff8:	e2 0e       	add	r14, r18
     ffa:	f3 1e       	adc	r15, r19
     ffc:	04 1f       	adc	r16, r20
     ffe:	15 1f       	adc	r17, r21
    1000:	e0 91 cb 01 	lds	r30, 0x01CB
    1004:	f0 91 cc 01 	lds	r31, 0x01CC
    1008:	a6 01       	movw	r20, r12
    100a:	c8 01       	movw	r24, r16
    100c:	b7 01       	movw	r22, r14
    100e:	09 95       	icall
    1010:	20 e0       	ldi	r18, 0x00	; 0
    1012:	30 e0       	ldi	r19, 0x00	; 0
    1014:	88 23       	and	r24, r24
    1016:	11 f0       	breq	.+4      	; 0x101c <FAT_LoadPartCluster+0x68>
    1018:	21 e0       	ldi	r18, 0x01	; 1
    101a:	30 e0       	ldi	r19, 0x00	; 0
	else return 0;
}
    101c:	c9 01       	movw	r24, r18
    101e:	1f 91       	pop	r17
    1020:	0f 91       	pop	r16
    1022:	ff 90       	pop	r15
    1024:	ef 90       	pop	r14
    1026:	df 90       	pop	r13
    1028:	cf 90       	pop	r12
    102a:	08 95       	ret

0000102c <FAT_NextCluster>:

/*
//读整个簇
//Read the a cluster
//Not suitable for system which has few data RAM  
unsigned char FAT_LoadCluster(unsigned long cluster,BYTE * buffer)
{
	DWORD sector;
	unsigned char i;
	sector=FirstDataSector+(DWORD)(cluster-2)*(DWORD)SectorsPerClust;//calculate the actual sector number
	for(i=0;i<SectorsPerClust;i++)
	{
		if(FAT_ReadSector(sector+i,buffer+(i<<9)))break;
	}
	if(i==SectorsPerClust)return 0;
	else return 1;
}*/

//读下一簇簇号
//Return the cluster number of next cluster of file
//Suitable for system which has limited RAM
unsigned long FAT_NextCluster(unsigned long cluster)
{
    102c:	8f 92       	push	r8
    102e:	9f 92       	push	r9
    1030:	af 92       	push	r10
    1032:	bf 92       	push	r11
    1034:	cf 92       	push	r12
    1036:	df 92       	push	r13
    1038:	ef 92       	push	r14
    103a:	ff 92       	push	r15
    103c:	0f 93       	push	r16
    103e:	1f 93       	push	r17
    1040:	cf 93       	push	r28
    1042:	df 93       	push	r29
    1044:	cd b7       	in	r28, 0x3d	; 61
    1046:	de b7       	in	r29, 0x3e	; 62
    1048:	c0 50       	subi	r28, 0x00	; 0
    104a:	d2 40       	sbci	r29, 0x02	; 2
    104c:	0f b6       	in	r0, 0x3f	; 63
    104e:	f8 94       	cli
    1050:	de bf       	out	0x3e, r29	; 62
    1052:	0f be       	out	0x3f, r0	; 63
    1054:	cd bf       	out	0x3d, r28	; 61
    1056:	7b 01       	movw	r14, r22
    1058:	8c 01       	movw	r16, r24
	BYTE buffer[512];
	DWORD sector;
	DWORD offset;
	if(FAT32_Enable)offset = cluster/128;
    105a:	80 91 ca 01 	lds	r24, 0x01CA
    105e:	88 23       	and	r24, r24
    1060:	51 f0       	breq	.+20     	; 0x1076 <FAT_NextCluster+0x4a>
    1062:	57 01       	movw	r10, r14
    1064:	68 01       	movw	r12, r16
    1066:	37 e0       	ldi	r19, 0x07	; 7
    1068:	d6 94       	lsr	r13
    106a:	c7 94       	ror	r12
    106c:	b7 94       	ror	r11
    106e:	a7 94       	ror	r10
    1070:	3a 95       	dec	r19
    1072:	d1 f7       	brne	.-12     	; 0x1068 <FAT_NextCluster+0x3c>
    1074:	04 c0       	rjmp	.+8      	; 0x107e <FAT_NextCluster+0x52>
	else offset = cluster/256;
    1076:	af 2c       	mov	r10, r15
    1078:	b0 2e       	mov	r11, r16
    107a:	c1 2e       	mov	r12, r17
    107c:	dd 24       	eor	r13, r13
	if(cluster<2)return 0x0ffffff8;
    107e:	22 e0       	ldi	r18, 0x02	; 2
    1080:	e2 16       	cp	r14, r18
    1082:	f1 04       	cpc	r15, r1
    1084:	01 05       	cpc	r16, r1
    1086:	11 05       	cpc	r17, r1
    1088:	08 f4       	brcc	.+2      	; 0x108c <FAT_NextCluster+0x60>
    108a:	46 c0       	rjmp	.+140    	; 0x1118 <__stack+0x19>
	sector=FirstFATSector+offset;//calculate the actual sector
	if(FAT_ReadSector(sector,buffer))return 0x0ffffff8;//read fat table / return 0xfff8 when error occured
    108c:	80 91 b7 01 	lds	r24, 0x01B7
    1090:	90 91 b8 01 	lds	r25, 0x01B8
    1094:	a0 91 b9 01 	lds	r26, 0x01B9
    1098:	b0 91 ba 01 	lds	r27, 0x01BA
    109c:	a8 0e       	add	r10, r24
    109e:	b9 1e       	adc	r11, r25
    10a0:	ca 1e       	adc	r12, r26
    10a2:	db 1e       	adc	r13, r27
    10a4:	e0 91 cb 01 	lds	r30, 0x01CB
    10a8:	f0 91 cc 01 	lds	r31, 0x01CC
    10ac:	4e 01       	movw	r8, r28
    10ae:	08 94       	sec
    10b0:	81 1c       	adc	r8, r1
    10b2:	91 1c       	adc	r9, r1
    10b4:	a4 01       	movw	r20, r8
    10b6:	c6 01       	movw	r24, r12
    10b8:	b5 01       	movw	r22, r10
    10ba:	09 95       	icall
    10bc:	88 23       	and	r24, r24
    10be:	61 f5       	brne	.+88     	; 0x1118 <__stack+0x19>

	if(FAT32_Enable)
    10c0:	80 91 ca 01 	lds	r24, 0x01CA
    10c4:	88 23       	and	r24, r24
    10c6:	a1 f0       	breq	.+40     	; 0x10f0 <FAT_NextCluster+0xc4>
	{
		offset=cluster%128;//find the position
		sector=((unsigned long *)buffer)[offset];	
    10c8:	8f e7       	ldi	r24, 0x7F	; 127

⌨️ 快捷键说明

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