I'm getting graphical glitches if I modify 'too many' lines during hlank and also I seem only to be able to adjust like every 3-4th line, otherwise I also start to get graphic glitches.
Basically I fire a function as follows and add it to LCD interrupt:
Code: Select all
void interruptLCD(){
switch (LYC_REG)
{
case 0x00:
move_bkg(backgroundoffset1x,0);
LYC_REG = 0x03;
break;
case 0x03:
move_bkg(backgroundoffset3x,0);
LYC_REG = 0x06;
break;
case 0x06:
move_bkg(backgroundoffset5x,0);
LYC_REG = 0x09;
break;
case 0x09:
move_bkg(backgroundoffset2x,0);
LYC_REG = 0x0c;
break;
....
Code: Select all
STAT_REG = 0x45; // enable LYC=LY interrupt so that we can set a specific line it will fire at
LYC_REG = 0x00;
disable_interrupts();
add_LCD(interruptLCD);
enable_interrupts();
set_interrupts(VBL_IFLAG | LCD_IFLAG);
SHOW_BKG;
DISPLAY_ON;
while(1){....
Would appreciate some tips.