I've tried implementing scrolling in my emulator as
several games (SMB1/MEGAMAN/GALAGA/etc...) would be
playable if I could do it.
After several attempts, I have failed each time.
So, now I'm asking for help (obviously).
I've implemented SKINNY.TXT (Loopy's doc) to the letter as far
as I know. I'll post my logic (and the code around it) for each
piece of the doc.
My code will be the line above each of Loopy's bit descriptions:
Loopy_T = (Loopy_T&0xF3FF)|((val&3)<<9);
2005 first write:
Loopy_T = (Loopy_T&0xFFE0)|(val>>3);
x=d:00000111 <-- I can't get even tile-only scrolling so scr** that
2005 second write:
Loopy_T = (Loopy_T&0xFC1F)|((val&0xF8)<<2);
t:0111000000000000=d:00000111 <--what purpose does that serve?
2006 first write:
Loopy_T = (Loopy_T&0xFF)|((val&0x3F)<<8);
Loopy_T &= 0x3FFF;
2006 second write:
Loopy_T = (Loopy_T&0xFF00)|(val);
Loopy_V = Loopy_T;
scanline start (if background and sprites are enabled):
Loopy_V = (Loopy_V&0xFBE0)|(Loopy_T&0x041F);
frame start (line 0) (if background and sprites are enabled):
Loopy_V = Loopy_T;
If everything is right there (which there's I good chance it
is, I think), then I need to entirely change how I actually draw
the screen. Even if it's wrong, I probably should change it, since
it's well... take a look:
Right now, I get garbage on the screen (See "Originally... comment):
int tempADDR = ((nes.scanline/8)*32)+x;
// Originally "Loopy_V+tempADDR" was "nes.baseNT+tempADDR"
// and nes.baseNT was the address of the name table set in $2000.
int line = (nes.PPUMem[Loopy_V+tempADDR]) * 16;
//... nes.ADDR_CHR is the address set by $2000.
DrawTileLine(nes.PPUMem[nes.ADDR_CHR + line +(nes.scanline%8)],
nes.PPUMem[nes.ADDR_CHR + line+8+(nes.scanline%8)],x,colbits);
How would I change that to do scrolling? What extra processing of
Loopy_V do I need to do?
I've been stuggling on this for weeks, any help
would be greatly appreciated.
Thanks. Oh, and sorry for the huge post :(.