Understanding Backgrounds and Memory
Posted: Sat May 19, 2012 2:50 pm
Hi, I'm just starting to learn the intricacies of libnds through Patater's manual; I have some questions about setting the addresses for backgrounds with BG_BMP_BASE() macro.
In the example I'm looking at, there is a BG2 set at 256x256 pixels with 16-bit color, mapped at BG_BMP_BASE(0). The next init of BG3 is a 128x128 pixel, 16-bit and it starts at BG_BMP_BASE(8).
I was able to use mtheall's VRAM mapping utility to see that if I were to put BG3 at any other offset less than 8, it would have led to conflicts. My question is, is there any simple math trick to figure out exactly what the offset should be for the next background? Another question is, what is the difference between BG0, BG1 and BG2, BG3? What are BGs 0 and 1 commonly used for ?
Thanks,
bttf
In the example I'm looking at, there is a BG2 set at 256x256 pixels with 16-bit color, mapped at BG_BMP_BASE(0). The next init of BG3 is a 128x128 pixel, 16-bit and it starts at BG_BMP_BASE(8).
I was able to use mtheall's VRAM mapping utility to see that if I were to put BG3 at any other offset less than 8, it would have led to conflicts. My question is, is there any simple math trick to figure out exactly what the offset should be for the next background? Another question is, what is the difference between BG0, BG1 and BG2, BG3? What are BGs 0 and 1 commonly used for ?
Thanks,
bttf