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

📄 mp3hal.asm

📁 该软件为在sunplus的61单片机上实现的mp3播放器.里面有完整的源代码.
💻 ASM
字号:
.include ..\spce061\061reg.inc
.public _F_SIO_SendData
.public _F_SIO_WailDERQ
.public _F_SPI_WriteWord
.public _F_SPI_ReadWord
.code
//  Function: unsigned int F_SPI_ReadWord(void)
_F_SPI_ReadWord:   .proc
	push r2,r4 to [sp]
	
	r3=[P_IOB_Buffer];	 	
	r2=16;	
	r1=0;
//  Send Data Begin		
SPI_Receving_Rep:	
		r1 = r1 LSL 1;	 
		
	    r3 |= 0x0040;		//SPI_CLK __/--
	    [P_IOB_Buffer]=r3;
	    
	    nop;
	    r4=[P_IOB_Data];	//Read Data From SPI_SO	 
	       	      
	    r4 = r4 LSR 4;
	    r4 = r4 LSR 4;
	     	    	    
	    r3 &= 0xffbf;		//SPI_CLK      --\__
	    [P_IOB_Buffer]=r3;
	    
//	    r4 &= 0x0100;	    	    
		r4 &= 0x0001;
	    r1 |= r4;	    	    	      	
		r2-=1;	
		jnz  SPI_Receving_Rep	
//  Send Data End
//	r1 = r1 ROR 4;
//	r1 = r1 ROR 4;

    pop r2,r4 from [sp] ;   
	retf;
	.endp
	
	
		
//Function: F_SPI_WriteWord(UINT16 tData);
_F_SPI_WriteWord:  .proc
   	push bp to [sp];
   	bp = sp + 1; 		
   	push r1,r4 to [sp] ;
   	
   	r1=[bp+3];					//Get First Parament   
	r1=r1 ROR 4;
	r1=r1 ROR 2;   
	
   	r4=[P_IOB_Buffer];	
	r3=16;
	
//  Send Data Begin		
SPI_Transfer_Rep:	
		r4 &= 0xfdbf;
		r2 = r1&0x0200;		
		r4 |= r2 ;
	    [P_IOB_Buffer]=r4;	//Send Data
	    r4 |= 0x0040;		//SPI_CLK __/--
	    [P_IOB_Buffer]=r4;  
	    r4 &= 0xffbf;		//SPI_CLK      --\__
	    [P_IOB_Buffer]=r4;
	    r1=r1 ROL 1;			
		r3-=1;	
		jnz  SPI_Transfer_Rep	
//  Send Data End	

    pop r1,r4 from [sp] ;
    pop bp from [sp] ;   
	retf;
	.endp
			
//Function:	F_SIO_SendData(uchar &addr, uchar &Length);
//
_F_SIO_SendData:   .proc
	push bp to [sp];
	bp=sp+1;
	push r1,r5 to [sp]
	r4=[bp+3];		//Get Address of the Transfer Data 
	r3=[bp+4];		//Get Length of the Transfer Data
	r3=0x20;
	r5=[P_IOB_Buffer];
	
sio_rep:	
	r2=[r4++];
	r2=r2 ROR 4;
	r2=r2 ROR 2;
//  Send Data Begin	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.7
	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.6
	    	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.5
	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.4

		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.3
	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.2
	    	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    r2=r2 ROL 1;		//Send Bit.1
	
		r5 &= 0xfffc;
		r1 = r2&0x02;		
		r5 |= r1 ;
	    [P_IOB_Buffer]=r5;	//Send Data
	    r5 |= 0x0001;		//SCLK __/--
	    [P_IOB_Buffer]=r5;  
	    r5 &= 0xfffe;		//SCLK      --\__
	    [P_IOB_Buffer]=r5;
	    //r2=r2 ROL 1;		//Send Bit.0
//  Send Data End
	    	    	   	
	r3-=1;	
	jz  SIO_Transfer_End
	goto sio_rep
	
SIO_Transfer_End:	
    pop r1,r5 from [sp] ;
    pop bp from [sp] ;   
	retf;
	.endp
	
// Function: void F_SIO_WailDERQ();	
_F_SIO_WailDERQ:		.proc
    push r1,r1 to [sp];
WailDERQrep:
	r1 = [P_IOB_Buffer];
	r1 = r1 & 0x04;
	jnz  WailDERQrep;
	pop r1,r1 from [sp];
	retf;
	.endp	

⌨️ 快捷键说明

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