Repository navigation
Conversation
During active display a $2138 or $213B read gets the byte at the address the PPU itself is using, not the CPU's (the CPU's address still advances). Rules as MesenCE 2.2.1 has them: - OAM, H clock <= 1020: the range phase's sprite (one per two dots from the priority-rotation start). Later: the time phase walking this line's in-range sprites backward from dot 270, two dots per sliver; before dot 270 where the previous line's walk ended. - CGRAM: free in H clocks 0..87 and 1096..1363, on line 0, from the NMI line on and in forced blank. Otherwise the backdrop (0) while the sub screen has no layer enabled; with sub screen layers the CPU's address is kept (not modelled). snes.c installs g_ppu_beam_hook, the beam at the access's own clock; it answers only with the master-clock APU timeline, so other games keep the old reads. SNESRECOMP_PPU_RENDER_READS=0 turns it off. Secret of Evermore, all interpreted, against MesenCE: the attract replay was identical through NMI key 5997 (its reset-time RNG seed reads OAM on line 124 and CGRAM on line 125); now at every key, 9,287 of 9,287. The new-game replay stays at every key, 9,227 of 9,227. Switch off: parts at 5998 again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 3b73e98c0332c0aead2b279492882d09c2f8578b)
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.
for reasons I don't comprehend Evermore takes random numbers too serious and creates them in the middle of rendered frames.
Summary
During active display the PPU owns OAM and CGRAM. A CPU read of
$2138/$213Breturns the byte at the address the PPU isfetching at that moment; the CPU's address still advances. snesrecomp always answers with the CPU's address.
Rules, as MesenCE 2.2.1 has them:
while the sub screen has no layer enabled.
snes.cinstallsg_ppu_beam_hook, the beam at the access's own clock (from #241). It only answers on the master-clocktimeline (
RtlApuUseMasterClock), so other games keep today's reads.SNESRECOMP_PPU_RENDER_READS=0turns it off.Evidence
Secret of Evermore seeds its RNG at reset from reads on lines 124 and 125, so one wrong byte changes the rest of the run.
Attract replay, WRAM/VRAM/CGRAM/OAM hashed at every NMI against MesenCE 2.2.1, on main
e9c20732:SNESRECOMP_PPU_RENDER_READS=0): WRAM parts at NMI 5998, native and interpreted.After: identical at all 8,592 NMIs, native and interpreted.
<test: tests/ppu/… reads $2138/$213B at chosen H/V and checks the fetched byte> ← to write
Merge Danger
Door: two-way. One switch turns it off, and it is inactive unless the master-clock timeline is on.
Blast Radius: narrow. Only games on the master-clock timeline that read
$2138/$213Bduring active display.Limits: checked against one game's reads only. CGRAM with sub-screen layers on is not modelled (keeps the CPU's address).
Each
$2138read during rendering walks the lines above the beam, which would cost a game that polls it.