A splash screen that moves without drawing, the way Zelda's does
A splash screen for our square: the word SQUARE changing colour and a column of drops falling beside it, then a fade to black, and round again. Play it and just watch. The program is 227 instructions in 522 bytes, built and checked the same way.
Play it here The cartridge, to play anywhere that plays NES cartridges: splash.nes
On the screen
Nothing is drawn while it moves
The title screen of The Legend of Zelda is busy, with a waterfall pouring and colours shifting, yet once the picture is up the game does not write a single tile to it. The waterfall is a column of sprites that step down a couple of pixels each frame and jump back up after a short loop, so the water seems to fall forever. The colours change because the game rewrites one palette every few frames. When the screen has been up long enough it fades to black, again only by rewriting the palette, a little darker each time. This cartridge does the same with a word, drops and colours of its own.
| this cartridge | The Legend of Zelda | |
|---|---|---|
| frames it shows before the fade | 396 | 487 |
| tiles written meanwhile | 0 | 0 |
| times the colours change, and frames apart | 50, every 8 | 68, every 6 |
| pixels the falling sprites move each frame | 3 | 2 |
| frames before they jump back up | 8 | 8 |
| steps in the fade, and frames it takes | 5, over 16 | 10, over 40 |
As written
The part of the program this lesson is about. The whole program is a plain text file: splash.s
palette:
LDA $46
BEQ written
LDA #$3F
STA $2006
LDX $46
LDA #$00
STA $46
CPX #$01
BNE whole
;; The word's four colours.
LDA #$04
STA $2006
LDX #$04
four:
LDA $0300,X
STA $2007
INX
CPX #$08
BNE four
JMP back
;; All 32, each darker by $10 for every step of the fade; a colour that
;; would go below the darkest row is black.
whole:
LDA #$00
STA $2006
LDX #$00
dark:
LDA $0300,X
LDY $43
BEQ put
darker:
SEC
SBC #$10
BCC black
DEY
BNE darker
JMP put
black:
LDA #$0F
put:
STA $2007
INX
CPX #$20
BNE dark
back:
LDA #$00
STA $2005
STA $2005
LDA #$80
STA $2000