If you have H Int at each scanline your code should fit in a very small amount of cycles : we have about 488 68k cycles by scanline but the SGDK H int handler already eat a part of it (about 120 cycles) so it leave 350 cycles for your code.sega16 wrote:Using this code it will double SOME lines but not all.I believe the reason for this is because the code is not fast enough but what could I do to make it better?
You don't have to check for end of screen as H Int doesn't happen during VBlank so you can do frame initialization process in the V Int callback instead.
your H Int code can be :
Code: Select all
*((u16 *) GFX_DATA_PORT) = vscroll;
if (the_scroll ^= 1) vscroll--;
Code: Select all
...
// re init VScroll
vscroll=0x800;
// prepare H Int V Scroll writes
*((u32 *) GFX_CTRL_PORT) = GFX_WRITE_VSRAM_ADDR(0);