HiColor — 1792 colors on screen from a 4bpp background.
Port of krom (Peter Lemon)'s HiColor64PerTileRow demo (SNES/PPU/HDMA/HiColor64PerTileRow), the canonical "beat the palette
ceiling" technique. An H-timer IRQ fires on EVERY scanline and DMAs 16 bytes (8 colors) into CGRAM while the PPU is drawing; over one 8-line tile row that streams a full fresh 64-color set. Even tile rows render from CGRAM colors 0-63 while the stream refills 64-127 for the odd row, and vice versa — 28 rows x 64 = 1792 colors from a background mode that nominally allows 128.
- SNES Concepts
- H-timer IRQ ($4207/$4200 bit 4) — per-scanline CPU interrupts
- Raw IRQ handlers via irqSet() (see irq_stream.asm — ASM only)
- General DMA to CGRAM ($2122) during active display
- CGRAM double-banking via tilemap palette bits (rows alternate 0-3 / 4-7)
- The NMITIMEN shadow: nmiSet/irqEnable compose instead of clobbering
- What to Observe
- A sunset over water with perfectly smooth gradients — 377 distinct colors on screen (measure any static 4bpp screen: max 128). The top of each 8-pixel band is where the palette race lives; the H-timer is set so the DMA lands in H-blank for THIS handler (128, not krom's 190 — see the comment at irqSetHTimer()).
- Modules Used
- console, dma, background
- See also
- https://github.com/PeterLemon/SNES — original demo & converter
-
docs/tutorials/graphics.md