Page 1 of 1

[SOLVED] SMB Title Screen isn't rendering in a proper way

Posted: Sun Mar 17, 2019 11:23 am
by dawid9554
Hi, everyone!

Okay, first of all, I apologize in advance if you have any problems with reading this post caused due to my english language skills.

Back to the topic... A few weeks ago I started a project of my own NES emulator. I already finished the CPU emulation and I'm currently working on a PPU emulation and screen display. However, when I test it, things seem to behave quite weird.
I'm going to describe my problem and show you a few examples.

The title screen in Super Mario Bros. 1 is not rendering in a proper way:
Image

Also there are those garbage tiles during demo play:
Image

But during a normal gameplay, everything displays properly:
Image

Battle City's title screen seems to suffer from a same problem:
Image

But the game is completely unplayable:
Image

In Mappy, when you walk on a flat floor, you suddenly fall through it and loses a life and in Pacman you can eat walls and escape the maze.

Another weird thing is when I tested my emulator with a Nestest, it passed all documented opcodes tests.
Image

But when I run any of Blargg's CPU opcode test ROMs, it failes and in result I get an unreadable garbage.

I double checked all the CPU code, opcodes execution, addresing modes, JMPs, JSR, NMI and couldn't manage to find any bug that would cause those kinds of glitches. ROMs are not corrupted in any way and the read buffer during the $2007 read is implemented correctly.
Also please, don't pay much attention to the incorrect color assignment and white dots, I haven't implemented tile coloring based on attribute tables yet and sprites are temporarily represented as dots.

Thank you in advance for any ideas and your help ^-^

Re: SMB Title Screen isn't rendering in a proper way & more

Posted: Sun Mar 17, 2019 3:16 pm
by Zepper
Hmm... Try checking $2007 reads, the 1-byte buffered stuff.
Another point is the PPU address. Look at writes to $2007 and how the address is handled there.

Re: SMB Title Screen isn't rendering in a proper way & more

Posted: Sun Mar 17, 2019 4:07 pm
by dawid9554
Zepper wrote:Try checking $2007 reads, the 1-byte buffered stuff.
Oh my goodness... for a whole time I was reading values from $2007 immediately, not through a 1 byte buffer delay!
I fixed that and now everything works like a charm! Oh me silly :\

Image

Thank you a lot, Zepper ^-^

Re: SMB Title Screen isn't rendering in a proper way & more

Posted: Sun Mar 17, 2019 5:27 pm
by tokumaru
That's the first thing that comes to mind, but you did say that "the read buffer during the $2007 read is implemented correctly", so...

Re: SMB Title Screen isn't rendering in a proper way & more

Posted: Sun Mar 17, 2019 6:30 pm
by dawid9554
Well, at first I was pretty sure it was, but it actually wasn't done the way it should be done.

Re: [SOLVED] SMB Title Screen isn't rendering in a proper way

Posted: Mon Jun 01, 2020 3:46 am
by ashkalov
Good day.
I am Russian and apologize in advance for my English.
I could not resist and say thank you!
I had the same problem!