bfirsh / bfirsh/jsnes

PPU: minor rendering issues (odd-frame skip, monochrome bg, sprite 0 left-column)

Open
#607 0 comments 0 reactions 0 assignees View on GitHub
accuracy bug component: ppu difficulty: easy priority: low
Dominant language
JavaScript
Stars
6.4k
Forks
857
PR merge metrics
No merged PRs in 30d

Description

## Summary

Three small PPU issues:

### 1. Odd-frame cycle skip is dead code (ppu/index.js:402-406)

`dummyCycleToggle` is initialized to `false` and never set to `true` anywhere, so odd frames are never shortened by 1 dot. Real NTSC NES alternates between 341-dot and 340-dot frames (when rendering is enabled).

### 2. Monochrome mode background color is nonsensical (ppu/index.js:502-527)

When `f_dispType === 1` (monochrome), the code picks hardcoded RGB colors (green, blue, red) based on the emphasis bits. Real hardware doesn't work this way — emphasis attenuates color channels regardless of greyscale mode.

### 3. Sprite 0 hit missing left-column and x=255 checks

Per [nesdev](https://www.nesdev.org/wiki/PPU_OAM#Sprite_zero_hits), sprite 0 hit should not fire when:
- Background or sprite left-column clipping is active (left 8 pixels hidden via PPUMASK bits 1-2)
- At x=255

The current `checkSprite0()` doesn't check these conditions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.