#160707 - thesean - Sun Jul 20, 2008 9:04 pm
Hi all, I'm having what I'm guessing is a simple problem, but I can't figure it out =/
I'm displaying 2 backgrounds, one on main, one on sub, and printing console text to the sub screen. All of this works fine. I was using a third background on the main screen, a 128x128 one, but I don't want to use it at this point and have commented it out.
When I comment out the third background, my main screen background goes black, but only if it's horizontal scroll register is set to 0. If I set the scroll register to anything greater than 0, it shows up fine, otherwise, the whole main screen goes black (and covers up 1 of my 2 sprites).
If anyone has any hints toward what to check for, I'd be very grateful. Here's the code in question:
The perplexing part (and probably for a simple reason) is that if I don't comment out this line:
the whole thing works fine...
Last edited by thesean on Sun Jul 20, 2008 10:09 pm; edited 1 time in total
I'm displaying 2 backgrounds, one on main, one on sub, and printing console text to the sub screen. All of this works fine. I was using a third background on the main screen, a 128x128 one, but I don't want to use it at this point and have commented it out.
When I comment out the third background, my main screen background goes black, but only if it's horizontal scroll register is set to 0. If I set the scroll register to anything greater than 0, it shows up fine, otherwise, the whole main screen goes black (and covers up 1 of my 2 sprites).
If anyone has any hints toward what to check for, I'd be very grateful. Here's the code in question:
Code: |
BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(0) | BG_PRIORITY(3) | BG_WRAP_ON; BG3_XDX = 1 << 8; BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = 1 << 8; //background at origin BG3_CX = 0; BG3_CY = 0; /* Don't want to use this BG at the moment (causes main bg to go black when h_scroll <= 0) //BG2_CR = BG_BMP16_128x128 | BG_BMP_BASE(6) | BG_PRIORITY(2); //BG2_XDX = 1 << 8; //BG2_XDY = 0; //BG2_YDX = 0; //BG2_YDY = 1 << 8; //place at correct spot... //BG2_CX = -(SCREEN_WIDTH / 2 - 32) << 8; //BG2_CY = -32 << 8; */ // setup bg3 control // SUB_BG3_CR is the register that controls BG3's behavior on the sub-display // this is the top screen background (works fine) SUB_BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(0) | BG_PRIORITY(2) | BG_WRAP_ON; SUB_BG3_XDX=1<<8; SUB_BG3_XDY=0; SUB_BG3_YDX=0; SUB_BG3_YDY=1<<8; //1<<8 = 256 // scroll the bg past the section used by the console SUB_BG3_CY = 16<<8; // CY is a fixed point number, 16*256 = 16.0 pixels //character tiles occupy map bases 0 and 1 //setup the console bg to map base 2 SUB_BG0_CR = BG_MAP_BASE( 2 ); //copy the backgrounds in to MM dmaCopyHalfWords(DMA_CHANNEL, botbgBitmap, (uint16 *) BG_BMP_RAM(0), botbgBitmapLen); //main //dmaCopyHalfWords(DMA_CHANNEL, planetBitmap, (uint16 *)BG_BMP_RAM(8), planetBitmapLen);//main - not used for now dmaCopyHalfWords(DMA_CHANNEL, topbgBitmap, (uint16 *)BG_BMP_RAM_SUB(0)+(8*1024)/2, topbgBitmapLen); //sub + 8 KB from console |
The perplexing part (and probably for a simple reason) is that if I don't comment out this line:
Code: |
//BG2_CR = BG_BMP16_128x128 | BG_BMP_BASE(6) | BG_PRIORITY(2); |
Last edited by thesean on Sun Jul 20, 2008 10:09 pm; edited 1 time in total