📄 filldataroutine_large_cf.asm
字号:
/************************************************************************************************/
/* This routine reads sectors from the compact flash into the pack_buffer. This routine is */
/* called only for CFs that have more than 4 sectors per cluster. Since we only want to read */
/* in 4 sectors at a time to fill up pack_buffer half way, this routine will be called more */
/* than once for each cluster number. It updates the cluster number only when we have read */
/* the enough sectors from the CF, namely it's sectors-per-clusters value */
/* Last Modified 02-26-03. H. Desai */
/************************************************************************************************/
.GLOBAL Big_CF;
.EXTERN Sectors_Left;
.EXTERN Parameters;
.EXTERN Current_Cluster;
.EXTERN Cluster_to_Sector;
.EXTERN Current_Sector_Number;
.EXTERN pack_buffer_wrptr;
.EXTERN pack_buffer;
.EXTERN Sectors_To_Read;
.EXTERN Calc_CHS;
.EXTERN Read_MP3;
.EXTERN Get_Next_Cluster;
.EXTERN CheckPredacSpace;
.SECTION program;
/**For CFs with greater than 4 sectors per cluster**/
Big_CF:
P0.H = Sectors_Left;
P0.L = Sectors_Left;
R0 = W[P0];
P0.H = Parameters;
P0.L = Parameters;
R1 = [P0+0x14]; //# of sectors per cluster
CC = R0 == R1; //See we are reading from the beginning of the cluster
IF !CC JUMP Big_CF_READ_MP3; //If this isn't the first time reading sectors from the same cluster, we do not want to re-read the current cluster
P0.H = Current_Cluster;
P0.L = Current_Cluster;
R0 = W[P0](Z); //Read the current cluster if this is the first time reading sectors from that cluster
CALL Cluster_to_Sector; //R5 = Sector #
P0.H = Current_Sector_Number;
P0.L = Current_Sector_Number;
W[P0] = R5; //Save off current sector #
Big_CF_READ_MP3:
P0.L = pack_buffer_wrptr; //Set up DAG registers for Pack Buffer
P0.H = pack_buffer_wrptr;
R0 = [P0];
I0 = R0;
L0 = 0x1000;
R0.L = pack_buffer;
R0.H = pack_buffer;
B0 = R0;
P0.H = Current_Sector_Number;
P0.L = Current_Sector_Number;
R5 = W[P0]; //Current sector #
P0.H = Sectors_To_Read;
P0.L = Sectors_To_Read;
R0 = W[P0](Z); //# of sectors to read in
P5 = R0;
LSETUP(Big_CF_Read_MP3_Data_BEGIN, Big_CF_Read_MP3_Data_END) LC0 = P5;
Big_CF_Read_MP3_Data_BEGIN:
R0 = R5;
CALL Calc_CHS;
Call Read_MP3;
R5 += 1; //Go to next Sector
Big_CF_Read_MP3_Data_END: NOP;
NOP;
P0.H = pack_buffer_wrptr;
P0.L = pack_buffer_wrptr;
R0 = I0;
[P0] = R0; //Save off Pack Buffer Write Pointer
P0.H = Current_Sector_Number;
P0.L = Current_Sector_Number;
W[P0] = R5; //Save off current sector #
P0.H = Sectors_To_Read;
P0.L = Sectors_To_Read;
R0 = W[P0]; //# of sectors read in
P0.H = Sectors_Left;
P0.L = Sectors_Left;
R1 = W[P0]; //# of sectors left within current cluster
R0 = R1 - R0; //Subtract number of sectors just read in from sectors left in current cluster
W[P0] = R0; //Save off # of sectors still left to read from current cluster
R1 = 0x0(Z);
CC = R0 == R1;
IF !CC JUMP Big_CF_Done_Reading_MP3;
CALL Get_Next_Cluster; //If we are done reading the current cluster, grab next cluster #
Big_CF_Done_Reading_MP3:
JUMP CheckPredacSpace;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -