33 minutes ago, AndyMt said:
I experimented with the raster line IRQ the last few days, too. I got it working, but there is very few cycles left you can use. Updating a (256) color palette seems almost impossible. I'll try to use the auto-increment feature of VERA, to improve this, by storing the 2nd palette in VRAM, too.
And that's with the emulator- no idea if this will work on real hardware.
It's simply impossible to update the entire palette during one scanline, even if you use every available hardware trick. There's only 254 (266) CPU cycles per scanline, the exact number depends on whether the CPU runs on dedicated 8 MHz clock, or a VGA clock divided by 3 (25.175 / 3 = 8.3196666 MHz) .
Since a simple LDA/STA combination to read and write from/to VERA data registers takes 8 cycles, even if you completely unroll the loop, you can copy 254 / 8 / 2 (2 bytes per palette entry) ~= 15 palette entries. And I'm not even taking the KERNAL IRQ handler overhead into account.
Even if there was a DMA chip somewhere in the system, it couldn't update the palette in one scanline beacuse it would need 256*2*2 = 1024 cycles, which also means that even a DMA internal to VERA couldn't do it because a VGA 640x480 scanline is only 800 cycles long.
The only way to update the entire palette in one scanline would be to have a relocatable palette.
So, you can only change a few colors each scanline and must design your graphics accordingly.