Skip to content

Interactive tutorial + palette pipeline overhaul#25

Open
kmatzen wants to merge 4 commits intomainfrom
behavioral-menu-tests
Open

Interactive tutorial + palette pipeline overhaul#25
kmatzen wants to merge 4 commits intomainfrom
behavioral-menu-tests

Conversation

@kmatzen
Copy link
Copy Markdown
Owner

@kmatzen kmatzen commented Apr 8, 2026

Summary

Three changes:

1. Interactive tutorial (docs/tutorial.html)

Single-page guide teaching how ChromA emulates GB on GBA:

  • Side-by-side hardware diagrams, register mapping visualizer
  • Memory map comparator, tile format conversion demo
  • 2D scanline beam visualization with PPU mode phases
  • Explains DMA3 palette delivery, source-reload limitation, counter-based mode selection

2. Palette pipeline overhaul

  • Remove gamma correction (5 brightness levels) — eliminates PALRAM/buffer format mismatch
  • Remove gbc_palette2 staging buffer and line 75 copytransfer_palette_ reads directly from pal_before (128-byte frame-start snapshot)
  • Wire up palette split detectionff69_w_tail records up to 8 mid-frame splits, VCount interrupts patch PALRAM at split boundaries
  • DMA3 always armed with counter-based mode:
    • ≤4 writes/GBA-frame → 1-word PALRAM self-refresh (no-op)
    • 4 writes → 64-word per-scanline buffer replay

  • Hercules GBC: title screen gradient (no flicker), gameplay colors correct

3. Test improvements

  • Memory addresses auto-detected from build/chroma.elf.map
  • Tests updated for gamma removal and Display submenu change

Test plan

  • 25 menu tests pass locally
  • Hercules GBC: title screen + gameplay verified manually
  • CI

🤖 Generated with Claude Code

kmatzen and others added 3 commits April 7, 2026 23:04
Single-page interactive tutorial (docs/tutorial.html) teaching how
ChromA emulates a Game Boy on a Game Boy Advance:

- Side-by-side GB/GBA hardware diagrams
- Interactive register mapping (Z80 → ARM) with animated connectors
- Memory map comparator with highlighted connections
- Tile format conversion demo showing 2bpp bitplane interleaving
- 2D scanline beam visualization with PPU mode phases
- HiDPI canvas rendering for Retina displays
- Tutorial link added to docs/index.html footer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Overhauls the palette pipeline:

- Remove gamma correction (5 brightness levels) and gbc_palette2
  staging buffer. transfer_palette_ reads from pal_before (128-byte
  frame-start snapshot taken at GB line 0).

- Wire up the previously dead pal_split infrastructure. ff69_w_tail
  records palette snapshots when the scanline changes (up to 8 splits).
  VCount interrupts patch PALRAM at split boundaries for mid-frame
  palette changes.

- DMA3 always armed with counter-based mode selection:
  ≤4 writes/GBA-frame: 1-word PALRAM self-refresh (no-op)
  >4 writes/GBA-frame: 64-word per-scanline buffer replay
  Counter cleared at GBA VBlank to avoid 2:1 frame ratio race.

- Remove line 75 palette copy (no longer needed).

Hercules GBC: title screen per-scanline colors (no flicker),
gameplay has correct colors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Overhauls the palette pipeline:

1. Remove gamma correction (5 brightness levels).

2. Remove gbc_palette2 staging buffer and line 75 copy. transfer_palette_
   reads from pal_before (128-byte frame-start snapshot taken at GB line 0).

3. Wire up the previously dead pal_split infrastructure. ff69_w_tail
   records palette snapshots when the scanline changes (up to 8 splits).
   VCount interrupts patch PALRAM at split boundaries for mid-frame
   palette changes.

4. DMA3 always armed with counter-based mode selection:
   - ≤4 writes/GBA-frame: 1-word PALRAM self-refresh (no-op)
   - >4 writes/GBA-frame: 64-word per-scanline buffer replay
   Counter cleared at GBA VBlank. The threshold discriminates games
   that tolerate EWRAM DMA per HBlank (per-scanline palette games)
   from those that don't (64-word EWRAM DMA overruns HBlank for
   normal games). This is a GBA hardware constraint, not a heuristic.

Hercules GBC: title screen per-scanline colors (no flicker),
gameplay has correct colors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kmatzen kmatzen force-pushed the behavioral-menu-tests branch from 1aba99c to 8352d56 Compare April 8, 2026 06:36
Replaces verbose palette delivery explanation with concise breakdown
of all 4 DMA channels per HBlank (DMA0: scroll+BG 6w, DMA1: DISPCNT
1w, DMA2: WIN0H 1w, DMA3: palette 1w/64w). Explains counter-based
mode selection, why 64-word can't be universal (EWRAM too slow,
no source-reload), and why a counter not a flag (2:1 frame race).

Event log now shows all 4 DMA channels during HBlank.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant