quephird / happiNESs

An attempt at an NES emulator written in Swift
5 stars 0 forks source link

OMFG I FIXED SKY SHARK #85

Closed quephird closed 4 days ago

quephird commented 5 days ago

So, the main purpose of this PR was to address the problem of a jumpy HUD in Sky Shark. The problem was due to my overlooking the following subtle statement in the NESDev wiki (https://www.nesdev.org/wiki/PPU_registers#PPUADDR_-_VRAM_address_($2006_write)):

"However, bit 14 of the internal t register that holds the data written to PPUADDR is forced to 0 when writing the PPUADDR high byte"

The result of my not doing so was that fine scroll Y in the temporary VRAM address was not being properly managed, and was off by four by the time the HUD was drawn (and about when PPUADDR was being updated by the game). The fix was to introduce a new bitmask, .bit14 in AddressBitMask and set the relevant bit to 0 when updating the high byte.

In the midst of this investigation, I also discovered a slew of other tiny but potentially significant bugs, including:

Two other changes that were made that were more cosmetic than bug fixes:

lulu-berlin commented 5 days ago

@quephird

Hi from @lulu@hachyderm.io! :heart: :wave: :blush:

Just a small note that you can now change this line in the README:

  - Sky Shark (HUD is jumpy)