NES Demo: Final Fantasy III Intro Screen
I've setup a new repo on Github for NES Demos that I sometimes write just for fun. Usually these stem from reverse engineering tidbits from existing ROMs, and adapting and improving upon what I learn from that process.
The first demo I've put in this new repo is a demo of how the effect on intro screen in Final Fantasy III is done. The demo code illustrates a few things:
- NES initialization
- Interacting with the PPU
- Using a self-modifying interupt handler
- The effect itself / using the attribute table
- A suitable text layout routine
Here's a brief description of the technique used for the effect:
- The first thing to keep in mind, is that FF3 writes each page to the nametable before the effect begins. You only see a blue screen as it's using the first palette (#0) at this stage.
- When the effect begins, each line of text is assigned palette #2. It then begins rotating color #3 (the primary color for the text.)
- When the palette effect is finished, the line is assigned palette #3. This results in the grey-ish color you see after the effect has finished.
- The palette changes are made by updating the attribute table per line as required.
The color rotation subroutine is the lynchpin for the entire effect. It uses a simple frame counter to count NMIs, making the text one shade lighter every 16 frames, or 3 times per second. For each odd-numbered frame in between (3, 5, 7, 9, 11, 13, 15), the text is made one shade darker, wrapping around at color #1 (dark-grey). Once the wrap-around occurs, the color will remain dark-grey until the 16th frame.
As always, see the code for a more in-depth explanation. I ain't had a chance to test this on my NES yet, but I can imagine it should work just fine.