Add subroutine to clear ppu nametables. Call during reset init after …#7
Open
Spacefreak18 wants to merge 1 commit intoNesHacker:mainfrom
Open
Add subroutine to clear ppu nametables. Call during reset init after …#7Spacefreak18 wants to merge 1 commit intoNesHacker:mainfrom
Spacefreak18 wants to merge 1 commit intoNesHacker:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request addresses the issue of garbage appearing in the background when using the compiled ROM on real hardware with an Everdrive N8 Pro.
#6
It didn't take me long to put together that something must not be init to zero, and while that is fine on emulators, causes a problem on real hardware. In this demo, only part of the nametable is setup with background tiles, mainly just the ground. The rest is left uninitialized and will point to garbage tiles in the ROM.
You can read more about this behavior here.
https://forums.nesdev.org/viewtopic.php?t=18135
Some emulators such as mesen allow you change the default behavior of the emulator (initializing RAM to zeros) to the default behavior of a real console, leaving the RAM initialized with garbage rather than zeros thereby allowing you to replicate this behavior.
The fix here adds two subroutines I pulled from the NESHacker nes-pi repository for clearing the nametables, and i add them to the reset subroutine right after the cpu ram is initialized to zero.
Right now i left it only clearing nametable a and nametable c, this would have to change if you changed the mirroring. I could add another subroutine that clears all nametables as well, which will cover either mirroring setting.