NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


Subjectscroll problems  
Posted byASMGuy
Posted on12/14/03 02:17 AM



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:

2000 write:
Loopy_T = (Loopy_T&0xF3FF)|((val&3)<<9);
t:0000110000000000=d:00000011
2005 first write:
Loopy_T = (Loopy_T&0xFFE0)|(val>>3);
t:0000000000011111=d:11111000
x=d:00000111 <-- I can't get even tile-only scrolling so scr** that
for now...
2005 second write:
Loopy_T = (Loopy_T&0xFC1F)|((val&0xF8)<<2);
t:0000001111100000=d:11111000
t:0111000000000000=d:00000111 <--what purpose does that serve?
2006 first write:
Loopy_T = (Loopy_T&0xFF)|((val&0x3F)<<8);
t:0011111100000000=d:00111111
Loopy_T &= 0x3FFF;
t:1100000000000000=0
2006 second write:
Loopy_T = (Loopy_T&0xFF00)|(val);
t:0000000011111111=d:11111111
Loopy_V = Loopy_T;
v=t
scanline start (if background and sprites are enabled):
Loopy_V = (Loopy_V&0xFBE0)|(Loopy_T&0x041F);
v:0000010000011111=t:0000010000011111
frame start (line 0) (if background and sprites are enabled):
Loopy_V = Loopy_T;
v=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):

for(int x=0;x<32;x++)
{
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 :(.





-
Entire Thread
Subject  Posted byPosted On
.scroll problems  ASMGuy12/14/03 02:17 AM
.*Re: scroll problems  <_Hyde_>12/14/03 02:29 AM
..*Re: scroll problems  <_Hyde_>12/14/03 06:40 AM
...*Re: scroll problems  ASMGuy12/14/03 07:02 AM
....*Re: scroll problems  ASMGuy12/14/03 07:23 AM
.....*Re: scroll problems  <_Hyde_>12/14/03 07:48 AM
......*Re: scroll problems  loopy12/14/03 4:21 PM
.......*Re: scroll problems  koitsu12/14/03 4:55 PM
...*Re: scroll problems  <_Hyde_>12/14/03 07:00 AM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo