Skip to content

Fixed FDS registers, and OAM Buffer#4637

Merged
YoshiRulz merged 2 commits intoTASEmulators:masterfrom
100thCoin:OamBuffer2004Fix
Mar 12, 2026
Merged

Fixed FDS registers, and OAM Buffer#4637
YoshiRulz merged 2 commits intoTASEmulators:masterfrom
100thCoin:OamBuffer2004Fix

Conversation

@100thCoin
Copy link
Contributor

@100thCoin 100thCoin commented Feb 23, 2026

A while back, I made changes to how APU registers are read. This is because APU registers are only readable if the 6502 address bus is within the range of $4000 to $401F. Unbeknownst to me, this change broke reads from the Famicom Disk System Registers. I have corrected that issue, and ran relevant tests.

Additionally, the primary purpose for me making this PR was to make a very small change to OAM evaluation, where writes to OAM2 become reads from OAM2. It was simply reading from OAM2[0] instead of using the OAM2 address, which I have corrected.

Relevant test for this OAM2 behavior. I'll admit that this isn't my most readable test. It just sets up OAM with a specific pattern, reads from $2004 on every ppu cycle of a specific scanline, (across a couple frames. This obviously cannot be done in a single frame) and then evaluates the results.

Previous results:
image

Error code 6 is pretty much saying that the data after those OAM2 writes become reads was incorrect.

After making this change:
image

Check if completed:

FDS registers don't need to be "Activated" like the APU registers.
After the OAM Address wraps around, writes to OAM2 are replaced with reads to OAM2. This was already being emulated, but importantly, the ppu continues reading from wherever the OAM2 address was.
@YoshiRulz YoshiRulz added the Core: NesHawk Nintendo Entertainment System (NES) / Famicom / Famicom Disk System (FDS) core label Feb 23, 2026
The Secondary OAM Address does not continue incrementing after Secondary OAM2 is full, even if new objects are found to be in-range with the scanline.
@100thCoin
Copy link
Contributor Author

I have updated the test I wrote for this behavior and discovered another small inaccuracy in NesHawk, which I have fixed. The new version of the test changed the error codes (so now the error codes are unfortunately a bit less descriptive), but now the test checks for what happens when there are 8 or more objects on the scanline being evaluated.

The small change I made here is that after secondary OAM is filled, the secondary OAM address is no longer incremented when finding new objects in range of the scanline. I simply replaced the line incrementing the secondary OAM address with a comment stating that the secondary OAM address is no longer incremented in this situation.

@YoshiRulz YoshiRulz merged commit daddb1c into TASEmulators:master Mar 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core: NesHawk Nintendo Entertainment System (NES) / Famicom / Famicom Disk System (FDS) core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants