The ds only has 4mb of memory. The size of all the static data is well over 4 mb. I think it is more like 6 to 8 mb.Yes, It handles the whole initialization, and no, you must not initialize each B[ I]. Matrixes are allocated in a contiguous line of memory. That is different from an array of pointers, that is
int *B[N] // array of N pointers to int
int (*B)[N] // pointer to a matrix of int of N colunms.
You can see this question in stackoverflow for more information, although I consider the third answer the correct answer for the problem, not the one selected by the user: https://stackoverflow.com/questions/14450123/c-pointer-to-a-matrix
I can't see why would It break DS. It shouldnt matter for any of the defines as long as they all evaluate to a constant (which they do since the memory is allocated in compile time) The pitch (N) will still be the same so the macros will all expand to the correct positions.[/I][/I]
For compiling the issue is the default ds link script only allows 3.5 mb for everything - code and static variables. If this is exceeded than the link fails. I am not quite certain if this is a limitation of the nds format or it is just to allow ds/dsi compatible hybrid nds files.
Thanks for pointing out how it could be managed. I had only ever seen the array of pointers method for C before with dynamic allocation of multidimensional arrays.