Page 1 of 1

Early PPU dev: Background tile wrongly displayed

Posted: Sat Jul 04, 2015 5:07 pm
by Fumarumota
Hi guys,

I'm working in implementing the PPU of my emulator. CPU is already tested and it works good (according to the nestest.nes log, and Blargg's official/unofficial instructions tests).

I managed to get VBlank and NMI up and running, so now i'm working on getting some background displayed in the screen. The problem is that i don't know why these couple of tiles (screenshot attached) are displayed wrong :S. As you will be able to see, the title screen and the screen before donkey starts moving are displayed perfectly. But when the animation starts, the tile is wrong.

I checked my name table mirroring and seems to be right. I have implemented registers just as in loopy's scrolling doc. No attribute tables or sprites implemented yet. Also, checked with a couple of other games, and the tiles are displayed OK.

Can you guys point me to the right direction based on your vast experience :).

Thanks in advance.

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Posted: Sat Jul 04, 2015 7:16 pm
by Dwedit
Make sure you have the increment mode (1 byte vs 32 bytes) correct, I guess.

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Posted: Mon Jul 13, 2015 8:51 am
by Fumarumota
It seems that I had timed my frames wrongly. Substraction of odd frames' last cycle when render is enabled was done wrong, and because of that my frame was way shorter than normal:

Instead of making only the last scan line shorter, I was substracting last cycle from every scan line when rendering enabled (Duh!).

I fixed it and the issue appears to be gone.

I also double checked my 2006h/2007h accesses to vRam, and they look OK.
Thank you Dwedit.

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Posted: Tue Jul 21, 2015 12:34 pm
by Petruza
Fumarumota wrote:Substraction of odd frames' last cycle when render is enabled was done wrong
That's strange, in the first versions of my PPU the odd cycle was simply ignored and nothing like this happened.

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Posted: Tue Jul 21, 2015 2:51 pm
by tokumaru
Petruza wrote:That's strange, in the first versions of my PPU the odd cycle was simply ignored and nothing like this happened.
This means your emulator was off by only 1 cycle, while his was subtracting 1 cycle from every scanline, for a total error of 240 cycles. That's a significant difference.

Re: Early PPU dev: Background tile wrongly displayed

Posted: Wed Jul 22, 2015 7:40 am
by Petruza
Oh right, every scanline, ok.