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

📄 numofclusters.asm

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

/************************************************************************************************/
/*	The routine determines whether we have a Small CF (4 or less sectors per cluster) or a Big	*/
/*	CF (more than 4 sectors per cluster).  If we have a Small CF, it determines the number of	*/
/*	clusters that need to be read in depending on the # of sectors per cluster and how many		*/
/*	sectors we want to read in (expected in R0).  If we have a Big CF, it sets the				*/
/*	Partially_Full_Flag to let the main routine know which FillDataRoutine to jump to.			*/
/*															  Last Modified 02-26-03.  H. Desai */
/************************************************************************************************/

#include <def21535.h>
#include "Boot_Sector_Parameters.h"

.GLOBAL Determine_Num0fClusters_To_Read_In;
.GLOBAL Partially_Full_Flag;

.EXTERN Parameters;

.SECTION program;

Determine_Num0fClusters_To_Read_In:
P0.H = Parameters;
P0.L = Parameters;
R1 = [P0+0x14];						//# of sectors per cluster

R2 = 0x4(Z);
CC = R1 <= R2;						//Determine if CF has 4 or less sectors per clusters
IF CC JUMP LT_4_Sectors_Per_Cluster;

P0.H = Partially_Full_Flag;
P0.L = Partially_Full_Flag;
R2 = 0x1(Z);
B[P0] = R2;							//Set flag to indicate more than 4 sectors per cluster

R0 = 0x1;							//Bring in 1 cluster if more than 4 sectors per cluster
RTS;

LT_4_Sectors_Per_Cluster:

P0.H = Partially_Full_Flag;
P0.L = Partially_Full_Flag;
R2 = 0x0(Z);
B[P0] = R2;							//Clear flag to indicate 4 or less sectors per cluster

CC = BITTST(R1,0);
IF !CC JUMP GT_1_Sectors_Per_Cluster;

RTS;								//R0 = (# of sectors to bring in)/1.  R0 is the # of clusters to bring in

GT_1_Sectors_Per_Cluster:
CC = BITTST(R1,1);
IF !CC JUMP GT_2_Sectors_Per_Cluster;

R0 = R0 >> 1;						//R0 = (# of sectors to bring in)/2.  R0 is the # of clusters to bring in.
RTS;

GT_2_Sectors_Per_Cluster:

R0 = R0 >> 2;						//RO = (# of sectors to bring in)/4.  R0 is the # of clusters to bring in.
RTS;

.BYTE Partially_Full_Flag;

⌨️ 快捷键说明

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