Litewall for NES

This program displays colored patterns on a 10x8 grid of lights. The controller can be used to change the patterns in many ways. It uses several advanced techniques to allow hundreds of distinct colors on screen, even though the standard NES palette is only 52 colors.

On a front-loading Nintendo NES, it runs without any glitches. It is reported to work well on an AV Famicom. It also works decently in Nestopia 1.40. It will not work on a PAL NES.

A SNES version is also available, with identical features, except it uses Y and B instead of B and A on the controller:

Full ca65-compatible source code for both versions:



Start the program in a NES or equivalent. You should get a black screen. Follow the steps below to have each feature demonstrated in a way that makes its operation easily visible so that you can clearly see what it does.

Pattern selection: Press Right a few times. This cycles through the patterns. Press Left to go back the other direction. Keep going through patterns until you reach the clockwise spiral.

Animation speed: Press Down a few times. This slows down animation. Press Up several times. Now things move quickly, even though the light still pulses at the same rate. Note that some patterns aren't affected by this speed.

Shape changes: Hold B and press Left. This selects circles. Try B and other directions. Now, hold B and press Select then Left. Now you get windows. Release B then hold B again and press Left. Now you get circles again.

Color spectrum: Hold Select and press Left twice. This confines it to a portion of the spectrum. Hold Select and press Left once. This confines it to a an even smaller part of the spectrum, barely changing color. Hold Select and press Left three times. This returns to cycling through the entire spectrum.

Color rate: Note how the color is constantly changing. Hold Select and press Down. Now the color changes more slowly, but still cycles through the spectrum. Hold Select and press Down a few more times. This reduces the rate to zero, so that the color isn't changing at all.

Color fine-tune: Hold Select and press Right a few times. Each press slightly adjusts the color. This allows you to get just the color you want.

Color inversion: Hold Select and press A. This inverts the screen while held, so you can easily do it in time with music. Now, Hold Select and A, then while still holding A, release Select. This keeps the screen inverted. Hold Select and press Start to change the background color. Hold Select and press A to turn inverse back off.

Grayscale: Hold Select and press B. This removes color from everything. Hold Select and press B and A. This removes color and inverts everything. As with inversion, it can be kept on by releasing Select while holding B. Hold Select and press A then B to disable grayscale and inversion.

Tempo adjustment: Hold Start and press Up. This increases the tempo. Hold Start and press Down. This decreases it.

Tempo colors: Hold Start and press Left twice. This slightly alters the color each beat. Hold Start and press Left three times. This has it get dark on each beat, rather than bright. Hold Start and press Right twice. This fades in for one beat, then out for the next, etc. Press Left to cycle through patterns until you find the spinning pinwheel. Hold Start and press Right three times. This changes the brightness by one step each beat, which works well for patterns like this one. Try the other tempo modes on this pattern, as they have different effects than on the spiral. Hold Start and press Right once, then Left once to go back to normal flashes each beat. Press Right to go to the expanding circle pattern.

Tempo synchronization with music: Start some music with a clear beat. Hold Start and press B in time with 5 or more beats. Now the tempo is synchronized with the music. Every 15 or so beats, Hold Start and press B in time with 2 to 4 beats to fine-tune the tempo. After it's been fine-tuned for half a minute or so, it should stay well-synchronized. Hold Start and press Up/Down to adjust the tempo manually. Hold Start and press B once to go back to the synchronized tempo. See Tempo Synchronization below for a more complete description of this feature. If used correctly, it stays in time with the music quite well.

Tempo pause: Hold Start and press Select. This pauses all animation. Do that again to unpause.

Random pattern: Hold A and press Select. This selects a random pattern.

Direct pattern selection: Hold A and press Left. This should select the clockwise spiral pattern. Hold A and press Left twice. This should select the falling stars pattern. This allows 8 patterns to be directly selected. By default, Holding A and pressing Down twice switches to an all-black pattern, in case you want to end a sequence smoothly. It can be configured by holding any button while pressing reset.

Pattern memory: Switch to a some pattern. Hold A and B at the same time and press Select, then Left. This remembers the current pattern and settings. Now switch to a different pattern and change various settings. Now hold A and B and press Left. This recalls the pattern you first saved. Four patterns can be remembered at a time. This is useful if come across a combination that looks especially good, and want to quickly go back to it later.

Tempo synchronization

The tempo controls the brightness of some patterns. It can be manually adjusted by holding Start and pressing Up or Down. It can also be synchronized with music by holding Start and pressing B in time with the beat.

To establish a new synchronized tempo, hold Start, then tap B in time with at least 5 beats in a row. Then for the next half minute or so, every once in a while hold Start, then tap B in time with 2 to 4 beats (no more, no less). This will fine-tune the tempo to match. Each time this is done, the internal tempo value is made more accurate, and will thus stay in sync with the music better.

Occasionally a fine-tune might be needed again. If the music keeps getting out of sync, try re-establishing the tempo again rather than just fine-tuning it. ALso, when tapping the tempo, the on-screen pulsing will wait a couple of beats before synchronizing, to avoid jittering.

When in the "single brightness change each beat" tempo mode (Start+Right x3), some patterns run on an 8-beat measure. To synchronize this with the music's 8-beat measure, start tapping on the first beat of a measure when establishing the new tempo. This is the only time the measure can be synchronized with.

After synchronizing the tempo, it can be manually adjusted by holding Start and pressing Up/Down. Even after doing this, the synchronized tempo will be internally remembered; to go back to the synchronized one, hold Start and press B once.

To pause or unpause all animation, hold Start and press Select. While paused, the synchronized tempo will still be internally remembered, so that when you unpause, it won't be out of sync with the music.


To configure patterns, hold any button on the controller and resetting the NES. If your cartridge supports battery backup, these will be saved when you power off the NES.

The first screen sets the direct pattern change buttons. Press Left/Right to select a pattern, Start to preview it immediately. First sets which pattern is visible after resetting the NES, in case you want something other than black. Press Select to go to the second screen.

The second screen sets the main list of patterns available to cycle through normally. This list can be expanded by pressing A, or reduced by pressing B. This way you can remove patterns you don't want, or have the same pattern repeated in several locations (this also makes it more likely to be chosen when pressing A+Select for a random pattern). To move an entry to another position, press B to remove it, then move to the new position and press A to insert it. Press Select when done editing.

Move cursor
Change pattern
Start Preview pattern
Select Go to next screen
B Remove entry from list
A Insert new entry

Controls reference

Each table's functions involve holding the indicated button(s) and while keeping it held, pressing other buttons.

Pressed Alone
Adjust animation speed
Change pattern

Configure pattern list by holding any button while pressing reset, then pressing Select.

Hold Select: Color adjustments
Adjust color cycling rate
Left Set to stay close to current color
Left x2 Set to cycle around part of spectrum
Left x3 Set to cycle through entire spectrum
Right Slightly adjust color
Start Change background color for inverse mode
B Grayscale while held
A Inverse while held
B + A Inverse grayscale while held

To keep grayscale/inverse on, keep A and/or B held while releasing Select. To turn back off, hold Select and press A and/or B again.

Hold Start: Tempo adjustments
Adjust tempo
Left Set to get bright each beat:
Left x2 Set to get bright and change color each beat:
Left x3 Set to get dark each beat:
Left x4 Set to get dark and change color each beat:
Right Set to abrupt brightness changes:
Right x2 Set to smooth brightness changes:
Right x3 Set to single brightness step each beat:
Select Pause/resume
B Tap to synchronize tempo (see below)
Hold B: Shape changes
Up Square
Down Diamond
Left Circle
Right Hexagon
Select then Up Brick
Select then Down Triangle
Select then Left Windows
Select then Right Concentric Squares
Hold A: Direct pattern changes
Direct patterns 1-4
Up x2
Down x2
Left x2
Right x2
Direct patterns 5-8
Select Random pattern

Configure direct patterns by holding any button while pressing reset.

Hold A+B: Pattern memory
Select then Up,
or Right
Store current pattern and settings in one of four slots
Recall pattern last saved in slot

This remembers the pattern, animation rate, color settings, and tempo settings.