Early PPU dev: Background tile wrongly displayed

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Fumarumota
Posts: 45
Joined: Wed Nov 19, 2014 9:00 am
Location: Mexico

Early PPU dev: Background tile wrongly displayed

Post by Fumarumota » Sat Jul 04, 2015 5:07 pm

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.
Attachments
Screen with the wrong tile.
Screen with the wrong tile.
Donkey_2.png (7.18 KiB) Viewed 2515 times
Screen before animation starts.
Screen before animation starts.
Donkey_1.png (6.91 KiB) Viewed 2515 times
Title screen.
Title screen.
Donkey_0.png (8.37 KiB) Viewed 2515 times
Last edited by Fumarumota on Mon Jul 13, 2015 10:23 am, edited 2 times in total.
*** O-Nes-Sama emulator team ***

User avatar
Dwedit
Posts: 4333
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Post by Dwedit » Sat Jul 04, 2015 7:16 pm

Make sure you have the increment mode (1 byte vs 32 bytes) correct, I guess.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Fumarumota
Posts: 45
Joined: Wed Nov 19, 2014 9:00 am
Location: Mexico

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Post by Fumarumota » Mon Jul 13, 2015 8:51 am

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.
*** O-Nes-Sama emulator team ***

User avatar
Petruza
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Post by Petruza » Tue Jul 21, 2015 12:34 pm

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.

User avatar
tokumaru
Posts: 11770
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Early PPU dev: Background tile suddenly wrongly diplayed

Post by tokumaru » Tue Jul 21, 2015 2:51 pm

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.

User avatar
Petruza
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

Re: Early PPU dev: Background tile wrongly displayed

Post by Petruza » Wed Jul 22, 2015 7:40 am

Oh right, every scanline, ok.

Post Reply