#19325 - Gopher - Sat Apr 17, 2004 7:15 am
I'm working on a project that's implementing an hblank trick to draw up to 1,024 sprites at once. At present it's enabling only one interrupt (hblank) and so I wrote the handler to assume any interrupt is a hblank interrupt. Originally it worked only on VBA, not on actual hardware. Here was the code:
All I changed was eliminating the variable f at the begining and changing the last line to
and now it works on HW.
Can anyone tell me /why/ this fixed the problem? I don't even know what made me try it, it was basicly a shot in the dark.
thx
_________________
"Only two things are infinite: the universe, and human stupidity. The first is debatable." -Albert Einstein
Code: |
void InterruptHandler(void) { hword f=REG_IF; static int index=0; //we just assume it's vcount, since that's the only one we enable //if this is the line we're waiting for... if (REG_VCOUNT==batches[index].MaxY) { //if we haven't drawn the last set yet.. if (index<(NumTribbles>>5)-4) { //copy in the replacement for me (the guy 4 later) gbadMemCpy(batches[index+4].sprites,(gbasSpriteData + ((index&0x3)<<5)),32*4); index++; } else //if we're really at the end... { //reset the index to 0 index=0; } } REG_IF|=f; } |
All I changed was eliminating the variable f at the begining and changing the last line to
Code: |
REG_IF |= REGI_F; |
and now it works on HW.
Can anyone tell me /why/ this fixed the problem? I don't even know what made me try it, it was basicly a shot in the dark.
thx
_________________
"Only two things are infinite: the universe, and human stupidity. The first is debatable." -Albert Einstein