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

📄 calc_chs.asm

📁 ADI BF DSP的CF卡的读写源码
💻 ASM
字号:

/************************************************************************************************/
/*	The following routine initializes 6 8-bit register values for the compact flash card which 	*/
/*	are packed in 3 16-bit registers.  The 28-bit LBA Address (expected in R0) will be divided	*/
/*	into a Sector number (LBA7 - LBA0), a Cylinder LO number (LBA8 - LBA15), a Cylinder HI		*/
/*	number (LBA16 - LBA23), and a Head number (LBA24 - LBA27).  In addition, the Sector Count	*/
/*	register will be set to 1 and the Command register will be set to 0x20 to issue a Read		*/
/*	Sector Command.																				*/
/*															  Last Modified 02-26-03.  H. Desai */  
/************************************************************************************************/

.GLOBAL Calc_CHS;

.SECTION program;

Calc_CHS:

	R1 = R0 << 8;					//R0 holds LBA Address
	R2 = 0x0001(Z);
	R1 = R1 | R2;					//Sector Number(LBA7 - LBA0) | Sector Count
	R1.H = 0x0000;
	
	R2 = R0 >> 8;					//Cylinder HI (LBA23 - LBA16) | Cylinder LO (LBA15 - LBA8)
	R2.H = 0x0000;
	
	R3.H = 0x0F00;
	R3.L = 0x0000;
	R3 = R0 & R3;
	R3 = R3 >> 24;
	R4 = 0x20E0(Z);					//Bit 6 indicates that we are doing LBA addressing
	R3 = R3 | R4;					//Read Command | Head Number (LBA27 - LBA24)
	
	RTS;

⌨️ 快捷键说明

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