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

📄 mp3player.s

📁 diy硬盘mp3的程序
💻 S
📖 第 1 页 / 共 2 页
字号:
	.module MP3Player.c
	.area data(ram, con, rel)
_Key::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile C:\DATA\MP3\Player\Code2\MP3Player.c
	.dbsym e Key _Key c
_IsPlaying::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile C:\DATA\MP3\Player\Code2\MP3Player.c
	.dbsym e IsPlaying _IsPlaying c
	.area text(rom, con, rel)
	.dbfile C:\DATA\MP3\Player\Code2\MP3Player.c
	.dbfunc e main _main fV
	.even
_main::
	.dbline -1
	.dbline 25
; #include <iom128v.h>
; #include "fat.h"
; #include "ata.h"
; #include "vs1001.h"
; #include "remote.h"
; #include "main.h"
; #include "generic.h"
; #include "usb.h"
; #include <string.h>
; #include <stdio.h>
; #include <macros.h>
; 
; //******************************************************************
; //*	MAIN Global Variable
; //******************************************************************
; unsigned char SectorBuffer[512];
; unsigned char RemoteTextLine[5][40];
; volatile unsigned char Key = 0;
; volatile unsigned char IsPlaying = FALSE;
; 
; //*************************************
; // void main(void)
; //*************************************
; void main(void)
; {
	.dbline 26
; InitRemote();
	xcall _InitRemote
	.dbline 27
; InitUSB();
	xcall _InitUSB
	.dbline 28
; WDR();
	wdr
	.dbline 29
; WDTCR = 0x0f; // Watch Dog enable
	ldi R24,15
	out 0x21,R24
	.dbline 30
; VS1001Init(HARD);
	ldi R16,1
	xcall _VS1001Init
	.dbline 31
; init_ata(0);
	clr R16
	xcall _init_ata
	.dbline 32
; Reg_Test();
	xcall _Reg_Test
	.dbline 33
; InitFat();
	xcall _InitFat
	.dbline 34
; VS1001_SetVolume(50,50);
	ldi R18,50
	ldi R16,50
	xcall _VS1001_SetVolume
	.dbline 35
; Sine_Sweep();
	xcall _Sine_Sweep
	.dbline 36
; SEI();
	sei
	.dbline 38
; 
; DirBrowser(2);
	ldi R16,2
	ldi R17,0
	ldi R18,0
	ldi R19,0
	.dbline -2
	.dbline 39
; }
L1:
	.dbline 0 ; func end
	xjmp _DirBrowser
	.dbend
	.dbfunc e DirBrowser _DirBrowser fV
;             ch -> <dead>
;    LastCluster -> y+6
;        MaxFile -> R14,R15
;           Page -> R12,R13
;        FilePtr -> R10,R11
;        Cluster -> y+20
	.even
_DirBrowser::
	xcall push_arg4
	xcall push_gset5
	sbiw R28,10
	.dbline -1
	.dbline 45
; 
; //*************************************
; // void DirBrowser(unsigned long Cluster)
; //*************************************
; void DirBrowser(unsigned long Cluster)
; {
	.dbline 51
; extern unsigned char text[255];
; extern struct FileInfo File;
; unsigned long LastCluster;
; unsigned char ch;
; unsigned int MaxFile;
; int FilePtr = 0;
	clr R10
	clr R11
	.dbline 52
; int Page = 0;
	clr R12
	clr R13
	.dbline 54
; 
; Key = 0xff;
	ldi R24,255
	sts _Key,R24
	.dbline 55
; FilePtr = 0;
	.dbline 56
; Page = 99;
	ldi R24,99
	ldi R25,0
	movw R12,R24
	.dbline 57
; MaxFile = GetDir(Cluster,FilePtr,999,FALSE);
	clr R2
	clr R3
	std y+5,R3
	std y+4,R2
	ldi R24,999
	ldi R25,3
	std y+3,R25
	std y+2,R24
	std y+1,R11
	std y+0,R10
	movw R30,R28
	ldd R16,z+20
	ldd R17,z+21
	ldd R18,z+22
	ldd R19,z+23
	xcall _GetDir
	movw R14,R16
	xjmp L4
X0:
	.dbline 60
; 
; while(1)
; 		{
L6:
	.dbline 62
	.dbline 63
	wdr
	.dbline 64
	xcall __StackCheck
	.dbline 65
	clr R2
	sts _IsPlaying,R2
	.dbline 66
L7:
	.dbline 61
; 		while (Key == 0) 
	lds R2,_Key
	tst R2
	breq L6
	.dbline 68
; 			  {
; 			  WDR();
; 			  _StackCheck();
; 			  IsPlaying = FALSE;
; 			  }
; 		
; 		IsPlaying = TRUE;
	ldi R24,1
	sts _IsPlaying,R24
	.dbline 71
; 		// Down
; 	
; 		if ((Key == 0x01) || (Key == 0x81) || (Key == 0xff))
	lds R24,_Key
	cpi R24,1
	breq L12
	lds R24,_Key
	cpi R24,129
	breq L12
	lds R24,_Key
	cpi R24,255
	breq X2
	xjmp L9
X2:
L12:
	.dbline 72
; 		   {
	.dbline 73
; 		   if (Key == 0x01) FilePtr++;
	lds R24,_Key
	cpi R24,1
	brne L13
	.dbline 73
	movw R24,R10
	adiw R24,1
	movw R10,R24
L13:
	.dbline 74
;            if (Key == 0x81) FilePtr += SONGPAGE;
	lds R24,_Key
	cpi R24,129
	brne L15
	.dbline 74
	movw R24,R10
	adiw R24,5
	movw R10,R24
L15:
	.dbline 75
; 		   if (FilePtr >= MaxFile) FilePtr--;
	cp R10,R14
	cpc R11,R15
	brlo L17
	.dbline 75
	movw R24,R10
	sbiw R24,1
	movw R10,R24
L17:
	.dbline 76
; 		   if ((FilePtr / SONGPAGE) != Page)
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall div16s
	cp R16,R12
	cpc R17,R13
	breq L19
	.dbline 77
;                 {
	.dbline 78
; 				Page = FilePtr / SONGPAGE;
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall div16s
	movw R12,R16
	.dbline 79
;                 GetDir(Cluster,Page*SONGPAGE,SONGPAGE,TRUE); 
	ldi R24,1
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,5
	std y+3,R25
	std y+2,R24
	ldi R16,5
	ldi R17,0
	movw R18,R12
	xcall empy16s
	std y+1,R17
	std y+0,R16
	movw R30,R28
	ldd R16,z+20
	ldd R17,z+21
	ldd R18,z+22
	ldd R19,z+23
	xcall _GetDir
	.dbline 80
; 				RemoteSendScreen(DIR,(FilePtr%SONGPAGE));
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall mod16s
	mov R18,R16
	ldi R16,1
	xcall _RemoteSendScreen
	.dbline 81
; 				}
	xjmp L20
L19:
	.dbline 83
; 		   else
;                 {
	.dbline 84
; 				RemoteSendLine((FilePtr%SONGPAGE));
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall mod16s
	xcall _RemoteSendLine
	.dbline 85
;                 }
L20:
	.dbline 86
; 			Key = 0;
	clr R2
	sts _Key,R2
	.dbline 87
; 			}
L9:
	.dbline 91
; 				
; 		// Up
; 		
; 		if ((Key == 0x02) || (Key == 0x82))
	lds R24,_Key
	cpi R24,2
	breq L23
	lds R24,_Key
	cpi R24,130
	breq X3
	xjmp L21
X3:
L23:
	.dbline 92
; 		   {
	.dbline 93
; 		   if (Key == 0x02) FilePtr--;
	lds R24,_Key
	cpi R24,2
	brne L24
	.dbline 93
	movw R24,R10
	sbiw R24,1
	movw R10,R24
L24:
	.dbline 94
;            if (Key == 0x82) FilePtr -= SONGPAGE;
	lds R24,_Key
	cpi R24,130
	brne L26
	.dbline 94
	movw R24,R10
	sbiw R24,5
	movw R10,R24
L26:
	.dbline 95
; 		   if (FilePtr < 0) FilePtr = 0;
	movw R24,R10
	cpi R24,0
	ldi R30,0
	cpc R25,R30
	brge L28
	.dbline 95
	clr R10
	clr R11
L28:
	.dbline 96
; 		   if ((FilePtr / SONGPAGE) != Page)
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall div16s
	cp R16,R12
	cpc R17,R13
	breq L30
	.dbline 97
;                 {
	.dbline 98
; 				Page = FilePtr / SONGPAGE;
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall div16s
	movw R12,R16
	.dbline 99
;                 GetDir(Cluster,Page*SONGPAGE,SONGPAGE,TRUE); 
	ldi R24,1
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,5
	std y+3,R25
	std y+2,R24
	ldi R16,5
	ldi R17,0
	movw R18,R12
	xcall empy16s
	std y+1,R17
	std y+0,R16
	movw R30,R28
	ldd R16,z+20
	ldd R17,z+21
	ldd R18,z+22
	ldd R19,z+23
	xcall _GetDir
	.dbline 100
; 				RemoteSendScreen(DIR,(FilePtr%SONGPAGE));
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall mod16s
	mov R18,R16
	ldi R16,1
	xcall _RemoteSendScreen
	.dbline 101
; 				}
	xjmp L31
L30:
	.dbline 103
; 		   else
;                 {
	.dbline 104
; 				RemoteSendLine((FilePtr%SONGPAGE));
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall mod16s
	xcall _RemoteSendLine
	.dbline 105
;                 }	
L31:
	.dbline 106
; 			Key = 0;
	clr R2
	sts _Key,R2
	.dbline 107
; 			}	
L21:
	.dbline 111
; 			
; 		// Left		
; 	
; 		if (Key == 0x04) 
	lds R24,_Key
	cpi R24,4
	brne L32
	.dbline 112
; 		   {
	.dbline 113
; 		   Cluster = 2;	 // Root Dir
	ldi R20,2
	ldi R21,0
	ldi R22,0
	ldi R23,0
	movw R30,R28
	std z+20,R20
	std z+21,R21
	std z+22,R22
	std z+23,R23
	.dbline 115
; 		   
; 		   Key = 0xff;
	ldi R24,255
	sts _Key,R24
	.dbline 116
; 		   FilePtr = 0;
	clr R10
	clr R11
	.dbline 117
; 		   Page = 99;
	ldi R24,99
	ldi R25,0
	movw R12,R24
	.dbline 118
; 		   MaxFile = GetDir(Cluster,FilePtr,999,FALSE);
	clr R2
	clr R3
	std y+5,R3
	std y+4,R2
	ldi R24,999
	ldi R25,3
	std y+3,R25
	std y+2,R24
	std y+1,R11
	std y+0,R10
	ldd R16,z+20
	ldd R17,z+21
	ldd R18,z+22
	ldd R19,z+23
	xcall _GetDir
	movw R14,R16
	.dbline 119
; 		   }				
L32:
	.dbline 123
; 			
; 		// Right		
; 
; 		if (Key == 0x08) 
	lds R24,_Key
	cpi R24,8
	breq X4
	xjmp L34
X4:
	.dbline 124
; 		   {
	.dbline 125
; 		   GetDir(Cluster,FilePtr,1,FALSE);
	clr R2
	clr R3
	std y+5,R3
	std y+4,R2
	ldi R24,1
	ldi R25,0
	std y+3,R25
	std y+2,R24
	std y+1,R11
	std y+0,R10
	movw R30,R28
	ldd R16,z+20
	ldd R17,z+21
	ldd R18,z+22
	ldd R19,z+23
	xcall _GetDir
	.dbline 127
; 	   
; 		   if ((File.Attr & ATTR_DIRECTORY) == ATTR_DIRECTORY)
	lds R24,_File+259
	andi R24,16
	cpi R24,16
	brne L36
	.dbline 128
; 		   	  {
	.dbline 129
; 			  Key = 0xff;
	ldi R24,255
	sts _Key,R24
	.dbline 130
; 		   	  FilePtr = 0;
	clr R10
	clr R11
	.dbline 131
; 		   	  Page = 99;
	ldi R24,99
	ldi R25,0
	movw R12,R24
	.dbline 132
; 			  Cluster = File.FirstClust;
	lds R4,_File+260+2
	lds R5,_File+260+2+1
	lds R2,_File+260
	lds R3,_File+260+1
	movw R30,R28
	std z+20,R2
	std z+21,R3
	std z+22,R4
	std z+23,R5
	.dbline 133
; 		   	  MaxFile = GetDir(Cluster,FilePtr,999,FALSE);
	clr R2
	clr R3
	std y+5,R3
	std y+4,R2
	ldi R24,999
	ldi R25,3
	std y+3,R25
	std y+2,R24
	std y+1,R11
	std y+0,R10
	ldd R16,z+20
	ldd R17,z+21
	ldd R18,z+22
	ldd R19,z+23
	xcall _GetDir
	movw R14,R16
	.dbline 134
; 			  }
	xjmp L37
L36:
	.dbline 136
; 		   else 
; 		   	  {
	.dbline 137
; 		   	  Page = 99;
	ldi R24,99
	ldi R25,0
	movw R12,R24
	.dbline 138
; 		   	  FilePtr--;
	movw R24,R10
	sbiw R24,1
	movw R10,R24
	xjmp L41
L40:
	.dbline 140
; 		   	   	while(1)
; 		   	   		{
	.dbline 141
; 			   		Key = 0;
	clr R2
	sts _Key,R2
	.dbline 142
; 			   		FilePtr++;
	movw R24,R10
	adiw R24,1
	movw R10,R24
	.dbline 143
; 		   	   		if (FilePtr >= MaxFile) FilePtr--;
	cp R24,R14
	cpc R25,R15
	brlo L43
	.dbline 143
	sbiw R24,1
	movw R10,R24
L43:
	.dbline 144
; 		   	   		if ((FilePtr / SONGPAGE) != Page)
	ldi R18,5
	ldi R19,0
	movw R16,R10
	xcall div16s
	cp R16,R12
	cpc R17,R13
	breq L45
	.dbline 145
; 		   	   	  	   {

⌨️ 快捷键说明

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