#45866 - AkumaATR - Wed Jun 15, 2005 10:34 pm
I know this is nothing new, but after having read through related threads, I'm still stuck.
Initially I was thinking that I wanted to clear (to 0x00, black) my back buffer (mode 4) during each VBLANK.This didn't seem to work for some reason it was only clearing the screen for like every 4 of my new frames displayed (not sure why yet). (caused short lines to be drawn instead of points moving across the screen)
So now I'm simply trying to clear the back buffer to black after page flipping.
When I give count as ((240 * 160) / 2) / 2 for the DMA transfer (16-bit), it clears half the screen. However, when I set count to 0x4B00 to clear the entire screen, it doesn't work. It works for clearing 1/3 or 2/3 of the screen as well... so I can't understand why trying to clear all of it only appears to clear like 1/6 - 1/5 of it.
Relative code:
#define REG_DMA0SAD *(volatile uint32 *)0x40000B0
#define REG_DMA0DAD *(volatile uint32 *)0x40000B4
#define REG_DMA0CNT_L *(volatile ushort16 *)0x40000B8
#define REG_DMA0CNT_H *(volatile ushort16 *)0x40000BA
.
.
.
ushort16 black = 0x0000;
.
.
.
while(TRUE)
{
for (i = 0; i < TITLE_NUM_STARS; ++i)
{
if (stars[i].x == 0)
stars[i].x = 239;
else
--stars[i].x;
}
waitVBlank();
//flipPage();
REG_DMA0SAD = (unsigned int)&black;
REG_DMA0DAD = (unsigned int)video_buffer;
REG_DMA0CNT_L = 0x4B00;
REG_DMA0CNT_H = 0x8100;
//clearBackBufferMode4(0);
for (i = 0; i < TITLE_NUM_STARS; ++i)
plotPixelMode4(stars[i].x, stars[i].y, 1);
}
Note: I essentially turned off double-buffering by not page flipping and always working out of first half of vram (one page) in order to simplify things to figure out what's going on with my program.
ClearBackBufferMode4 was my ghetto slow routine I'm trying to replace with the DMA transfer.
Thanks Again,
Jason
Initially I was thinking that I wanted to clear (to 0x00, black) my back buffer (mode 4) during each VBLANK.This didn't seem to work for some reason it was only clearing the screen for like every 4 of my new frames displayed (not sure why yet). (caused short lines to be drawn instead of points moving across the screen)
So now I'm simply trying to clear the back buffer to black after page flipping.
When I give count as ((240 * 160) / 2) / 2 for the DMA transfer (16-bit), it clears half the screen. However, when I set count to 0x4B00 to clear the entire screen, it doesn't work. It works for clearing 1/3 or 2/3 of the screen as well... so I can't understand why trying to clear all of it only appears to clear like 1/6 - 1/5 of it.
Relative code:
#define REG_DMA0SAD *(volatile uint32 *)0x40000B0
#define REG_DMA0DAD *(volatile uint32 *)0x40000B4
#define REG_DMA0CNT_L *(volatile ushort16 *)0x40000B8
#define REG_DMA0CNT_H *(volatile ushort16 *)0x40000BA
.
.
.
ushort16 black = 0x0000;
.
.
.
while(TRUE)
{
for (i = 0; i < TITLE_NUM_STARS; ++i)
{
if (stars[i].x == 0)
stars[i].x = 239;
else
--stars[i].x;
}
waitVBlank();
//flipPage();
REG_DMA0SAD = (unsigned int)&black;
REG_DMA0DAD = (unsigned int)video_buffer;
REG_DMA0CNT_L = 0x4B00;
REG_DMA0CNT_H = 0x8100;
//clearBackBufferMode4(0);
for (i = 0; i < TITLE_NUM_STARS; ++i)
plotPixelMode4(stars[i].x, stars[i].y, 1);
}
Note: I essentially turned off double-buffering by not page flipping and always working out of first half of vram (one page) in order to simplify things to figure out what's going on with my program.
ClearBackBufferMode4 was my ghetto slow routine I'm trying to replace with the DMA transfer.
Thanks Again,
Jason