Screen fade in/out using INIDISP brightness control. More...
Functions | |
| int | main (void) |
| Entry point – cycles through fade-out/fade-in at three speeds. | |
| static void | wait_for_key (void) |
| 4bpp tile data for the background image. | |
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.
| int main | ( | void | ) |
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.
|
static |
4bpp tile data for the background image.
Tilemap data (32x32 tile grid) for the background image.
15-bit BGR palette (up to 16 colors) for the background image.
Block until the user presses a button (with debounce).
First waits for all buttons to be released (if any are held), then waits for a new button press. This two-phase approach prevents the same press from being detected twice and ensures clean transition between fade steps. Each iteration calls WaitForVBlank() to yield CPU time and synchronize with the display refresh.