I have been trying to figure this routine out for more than 40minutes now
But i still do not get how it works
void DrawSprite(int rx,int ry,int s)
{
int countery,counterx;
char pixel;
for(countery=0;countery<s;countery++)
{
pixel=memory[I+countery];
for(counterx=0;counterx<8;counterx++)
{
if((pixel&(0x80>>counterx))!=0)
{
if(screen[rx+(ry*64)]==1)
{
V[0xF]=1;
}
screen[rx+(ry*64)]^=1;
}
}
}
}
Why is there a need to go through the same loop 8 times if any number is going to be the same anyway NUM&0x80=80 or 0
Is not it highly CPU consuming
But i still do not get how it works
void DrawSprite(int rx,int ry,int s)
{
int countery,counterx;
char pixel;
for(countery=0;countery<s;countery++)
{
pixel=memory[I+countery];
for(counterx=0;counterx<8;counterx++)
{
if((pixel&(0x80>>counterx))!=0)
{
if(screen[rx+(ry*64)]==1)
{
V[0xF]=1;
}
screen[rx+(ry*64)]^=1;
}
}
}
}
Why is there a need to go through the same loop 8 times if any number is going to be the same anyway NUM&0x80=80 or 0
Is not it highly CPU consuming