GUNNM a écrit :
Je ne peux pas remplir un tableau de grande taille, surement parce qu'il n'y a plus assez de mémoire...Faut il que j'utilise les transferts DMA? comment ça marche pour un tableau comme ça:
int zbuffer[160][240];
for (i=0; i<160; i++)
{
for (j=0; j<240; j++)
{
zbuffer[i][j]=0;
}
}
Ben en faisant DmaClear(3, 0, Zbuffer, (Size du tableau colonne*ligne), 16);
Sinon voila la définition de la fonction de chez nintendo (intégré au gnu)
/////////////
#define DmaClear(DmaNo, Data, Destp, Size, Bit)
{
vu##Bit Tmp = (vu##Bit )(Data);
DmaSet(DmaNo, &Tmp, Destp, (
DMA_ENABLE | DMA_TIMMING_IMM |
DMA_SRC_FIX | DMA_DEST_INC |
DMA_##Bit##BIT_BUS | ((Size)/(Bit/8))));
}
#define DmaClearIf(DmaNo, Data, Destp, Size, Bit)
{
vu##Bit Tmp = (vu##Bit )(Data);
DmaSet(DmaNo, &Tmp, Destp, (
DMA_ENABLE | DMA_TIMMING_IMM |
DMA_IF_ENABLE |
DMA_SRC_FIX | DMA_DEST_INC |
DMA_##Bit##BIT_BUS | ((Size)/(Bit/8))));
}
#define DmaArrayClear( DmaNo, Data, Destp, Bit)
DmaClear( DmaNo, Data, Destp, sizeof(Destp), Bit)
#define DmaArrayClearIf(DmaNo, Data, Destp, Bit)
DmaClearIf( DmaNo, Data, Destp, sizeof(Destp), Bit)
//* Clear RAM with DMA.
//* Clear Data is placed in a Stack and copied to the Destination.
//* DmaClearIf/DmaArrayClearIf generates an Interrupt Request when ending.
//* DmaArrayClear/DmaArrayClearIf clears the entire Destination Array.
//
//* Arguments:
// DmaNo DMA Number
// Data Clear Data
// Destp Destination Address
// Size Clear Byte Size
// Bit Transfer Bit Width (16|32)
//
//
// *By running DMA with a program in the CPU internal RAM,
// the instruction immediately following is executed first.
// Due to this, when you attempt to change the transfer
// destination with the CPU directly following DMA, the DMA
// will run during Read/Rewrite. Thus, there are cases when
// the DMA destination data can become a value that was not
// intended. In this case, if you insert DmaWait() directly
// following, you can check if DMA has finished and be sure to
// avoid any impact on following code.