aprentice
Moderator
zenogais said:Well, the curent timer implementation I've written does reset it to zero after it reaches 153, but I may just try removing that or making it a compiler option. Thanks for the heads up bcrew.
I also have a question I was just pondering. Right now I am thinking of writing the video system so that each pixel written to my screenBuffer takes up two bits which denote its color. Then as I draw the data onto the screen during VBlank I read through each byte from the screenBuffer and draw 4 pixels from that, each of the specified color. Is this how you guys are doing it, and would this even work?
why don't you just make an array that holds the real color in 32bit? Reading through the video screen array would kill some speed, i use to have it like that ages ago, then when i changed it to write directly to video memory the speed up was huge.
edit:
examples
PHP:
unsigned long palette[4];
unsigned long gb_bgpal[4], gb_spr_pal[2][4];
void set_palette_dept(int bits)
{
if(bits==16)
{
palette[0]=((0xFF/8)<<11)|((0xFF/4)<<5)|(0xFF/8);
palette[1]=((0x8D/8)<<11)|((0x8D/4)<<5)|(0x8D/8);
palette[2]=((0x69/8)<<11)|((0x69/4)<<5)|(0x69/8);
palette[3]=((0x00/8)<<11)|((0x00/4)<<5)|(0x00/8);
gb_bgpal[0]=gb_spr_pal[0][0]=gb_spr_pal[1][0]=palette[0];
gb_bgpal[1]=gb_spr_pal[0][1]=gb_spr_pal[1][1]=palette[1];
gb_bgpal[2]=gb_spr_pal[0][2]=gb_spr_pal[1][2]=palette[2];
gb_bgpal[3]=gb_spr_pal[0][3]=gb_spr_pal[1][3]=palette[3];
}
else if(bits==24 || bits==32)
{
palette[0]=0xFFFFFF;
palette[1]=0x8D8D8D;
palette[2]=0x696969;
palette[3]=0x000000;
gb_bgpal[0]=gb_spr_pal[0][0]=gb_spr_pal[1][0]=palette[0];
gb_bgpal[1]=gb_spr_pal[0][1]=gb_spr_pal[1][1]=palette[1];
gb_bgpal[2]=gb_spr_pal[0][2]=gb_spr_pal[1][2]=palette[2];
gb_bgpal[3]=gb_spr_pal[0][3]=gb_spr_pal[1][3]=palette[3];
}
if(bits==16) main.pixelwidth=2;
else if(bits==24) main.pixelwidth=3;
else main.pixelwidth=4;
}
Last edited: