Alright, so after a couple of days trying to figure out sprite evaluation & fetching, I think I've got something that's starting to be relatively decent (but it doesn't quite 100% match the hardware, according to the tests)
I've based a lot of this on the info in these threads:
As well as this GitHub issue (and test rom): https://github.com/MiSTer-devel/SNES_MiSTer/issues/69
And also this VHDL implementation: https://github.com/MiSTer-devel/SNES_Mi ... rc/PPU.vhd
Huge thanks to paulb_nl for all the time you've obviously spent trying to figure out these details! :)
What I have at the moment looks like this (some of this are guesses - not actual hardware-verified behavior):
H=0-255: Sprite evaluation:
Even cycles: Read X+Y (word) + high oam value
Odd cycles: Write sprite index in the 32-entry 7-bit table (if the sprite is visible on the line)
H=0-263: BG tilemap+tile fetching
H=270-337: OAM reading to determine which VRAM addresses need to be fetched (starting from the last sprite index stored during evaluation)
Even cycles: Read X+Y (word)
Odd cycles: Read 2nd word (priority, palette, etc), determine the VRAM address to load on the next cycle. If all tiles for this sprite have been processed (e.g based on its width), move on to the next sprite index in the sprite evaluation table.
H=272-339: VRAM fetches for the sprites
Even cycles: Read first word of sprite tile, based on the address calculated on the previous cycle
Odd cycles: Read the 2nd word of the sprite tile
I've tried to keep track of as many details as I could find (but I'm sure I'm missing a few things).
The HBlankTest & "YourEmuSuxx" tests both look half corrupted in both PAL/NTSC. It's far from perfect, but closer than before.
paulb_nl's sprite_oam_test_short_fblank test rom seems to be behaving pretty close to what is seen in his youtube video.
With these changes, Uniracers now runs properly without having to add a hack-ish solution to make it work.
Also, the "lamp" at the top of the screen in Aladdin is correctly missing the first row of pixels due to the game disabling rendering during hblank (as mentioned here: viewtopic.php?p=231483#p231483
byuu wrote:It's pedantic, I know, but as you saw, Sour just fixed a test ROM that's supposed to fail.
I'm hoping to eventually get around to gathering them up either on a wiki page or github repo and defining their expected results (on different consoles, when it matters). At least that way there would be a central place to get information on the tests that exist, rather than finding them on random websites, repos and forum threads. Might be a while before I can find the time, though.