Just for fun, I'm writing a NES emulator based on javidx9's awesome YouTube series. I'm writing mine in Swift instead of C, just for the challenge. Anyway, my PPU isn't generating the proper image. It seems to be creating a repeated pattern (see below for a screenshot of Super Mario Bros title screen). I've tripe checked the code and all looks right but I didn't know if this is maybe an obvious problem that someone might know where to look.
Thanks!
PPU producing repeating pattern
Moderator: Moderators
Re: PPU producing repeating pattern
It is repeated 8 times, so that must be a clue. It seems you're only drawing the first line of each tile instead of all 8 lines.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
Re: PPU producing repeating pattern
The obvious thing here is that the pattern is repeated 8 times, and tiles are 8 pixels tall... It looks like you're rendering every 8th scanline for whatever reason. Check the vertical PPU address increment at the end of the scanline, it should be incrementing the fine Y scroll by 1, but it looks like you're incrementing the coarse Y scroll instead.
Re: PPU producing repeating pattern
Yes! That was it! I had a bug in setting one of the loopy registers which was setting the fineY to 0b111. Thank you!
Re: PPU producing repeating pattern
Also, I can see that the background color is wrong, it should not be separate for each group of 4 colors, it should be the same background color.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: PPU producing repeating pattern
Specifically, the background color should always be the value at PPU $3F00 (not $3F04/$3F08/$3F0C). Additionally, writes to PPU $3F10 should overwrite the value at $3F00.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
-
- Posts: 53
- Joined: Wed Sep 09, 2020 3:08 am
Re: PPU producing repeating pattern
Funnily enough, the multiple background color setup sounds like what GBC does.
Re: PPU producing repeating pattern
Things would be slightly more versatile if the NES worked like that... The PPU even stores unique color values in those addresses, it just never uses them (apart from when you turn rendering off and point the VRAM address at them).stan423321 wrote: ↑Thu Feb 11, 2021 10:05 am Funnily enough, the multiple background color setup sounds like what GBC does.
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact: