Screen fade in/out using INIDISP brightness control.
Demonstrates smooth screen fading by stepping through the 16 brightness levels of the SNES INIDISP register ($2100). Bits 0-3 of INIDISP control master brightness from 0 (black) to 15 (full), while bit 7 is the force blank flag. By writing successive brightness values with timed delays between frames, the display fades smoothly to or from black. Three fade speeds are showcased: fast (1 frame/step), medium (3 frames/step), and slow (6 frames/step). This technique is used in virtually every SNES game for scene transitions, title screens, and game-over sequences.
- SNES Concepts
- INIDISP register ($2100) brightness levels 0-15
- Frame-counted delay loops for animation timing
- setBrightness() library wrapper for safe INIDISP writes
- Force blank (bit 7) vs brightness dimming (bits 0-3)
- What to Observe
- Press any button to advance through fade effects
- Fast fade out (instant-feeling), then fast fade in
- Medium fade (noticeable transition), then slow fade (cinematic pace)
- The cycle repeats: fast, medium, slow, fast, ...
- Modules Used
- console, sprite, dma, input, background
- See also
- video.h, input.h, background.h
Entry point – cycles through fade-out/fade-in at three speeds.
Loads a background image, then enters an interactive loop where each button press triggers the next fade effect: fast (1 frame/step), medium (3 frames/step), and slow (6 frames/step). The cycle repeats indefinitely. This demonstrates how INIDISP brightness control provides smooth scene transitions without any per-pixel computation.
- Returns
- Does not return (infinite loop).