Multi-window HDMA — both windows' edges driven per scanline.
Port of krom (Peter Lemon)'s WindowMultiHDMA demo (PeterLemon/SNES, PPU/Window/WindowMultiHDMA). One HDMA channel in 4-register mode streams WH0-WH3 ($2126-$2129) — BOTH windows' left/right edges — every scanline band, cutting a grid of portholes into BG1: the four windows of an aerial tram, with the city at dusk behind them. The backdrop (CGRAM color 0, the tram's wall) shows wherever the combined window mask disables the layer; the D-pad scrolls the city underneath the static mask.
Window algebra (krom's exact setup): W1 and W2 both enabled on BG1 and both INVERTED, combined with AND — the layer is masked where (outside W1) AND (outside W2), i.e. visible inside either window.
- SNES Concepts
- HDMA_MODE_4REG: one channel drives 4 consecutive PPU registers/line
- Two windows animated per scanline (hdmaWindowShape covers only one)
- W12SEL / WBGLOG / TMW via windowEnable/windowSetInvert/ windowSetLogic/windowSetMainMask
- Backdrop color as the "outside the windows" fill
- What to Observe
- Four portholes in the tram's dark wall, the city and its reflection in a canal behind them. D-pad scrolls the city behind the fixed portholes.
- Modules Used
- console, dma, background, hdma, window, input
- See also
- https://github.com/PeterLemon/SNES — original demo
-
window.h, hdma.h (HDMA_MODE_4REG)
The city behind the portholes, 8bpp (devtools/art_assets/build.py).
VRAM: the map at word $0000, the tiles at $1000 (546 8bpp tiles, 34 KB, up to $543F: krom's $4000 would run past the end of VRAM). A BG's character base moves in steps of $1000 words (BG12NBA), so $1000 is the first one past the map.