Skip to content

fix(ppu): call present() at the end of each frame to display output#31

Merged
eddmann merged 1 commit into
mainfrom
claude/debug-tetris-white-screen-011CUy8KP6XAAGfngCQ8fVsh
Nov 9, 2025
Merged

fix(ppu): call present() at the end of each frame to display output#31
eddmann merged 1 commit into
mainfrom
claude/debug-tetris-white-screen-011CUy8KP6XAAGfngCQ8fVsh

Conversation

@eddmann

@eddmann eddmann commented Nov 9, 2025

Copy link
Copy Markdown
Owner

The PPU was writing pixels to the framebuffer correctly via setPixel(),
but never called present() to signal that the frame was complete and
ready to be displayed. This caused the CLI renderer to never output
frames to the terminal, resulting in a white screen.

This fix adds present() to the FramebufferInterface and calls it from
the PPU when a frame completes (when LY wraps from 153 back to 0 during
VBlank).

Changes:

  • Add present() method to FramebufferInterface
  • Implement present() in ArrayFramebuffer (no-op for testing)
  • Implement present() in WasmFramebuffer (no-op, JS polls for pixels)
  • CliRenderer.present() already implemented, now gets called
  • Call framebuffer->present() from PPU.stepVBlank() when frame completes

Fixes issue where Tetris and other games would show white screen in CLI
mode because present() was never invoked to trigger terminal rendering.

The PPU was writing pixels to the framebuffer correctly via setPixel(),
but never called present() to signal that the frame was complete and
ready to be displayed. This caused the CLI renderer to never output
frames to the terminal, resulting in a white screen.

This fix adds present() to the FramebufferInterface and calls it from
the PPU when a frame completes (when LY wraps from 153 back to 0 during
VBlank).

Changes:
- Add present() method to FramebufferInterface
- Implement present() in ArrayFramebuffer (no-op for testing)
- Implement present() in WasmFramebuffer (no-op, JS polls for pixels)
- CliRenderer.present() already implemented, now gets called
- Call framebuffer->present() from PPU.stepVBlank() when frame completes

Fixes issue where Tetris and other games would show white screen in CLI
mode because present() was never invoked to trigger terminal rendering.
@eddmann eddmann merged commit dabc663 into main Nov 9, 2025
1 check passed
@eddmann eddmann deleted the claude/debug-tetris-white-screen-011CUy8KP6XAAGfngCQ8fVsh branch November 10, 2025 10:23
eddmann added a commit that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants