liveBook · Manning

Intro screen

As explained in Classic Game Programming on the NES: Make your own retro video game

The introductory screen that presents a game's title and may wait for the player to begin.

An intro screen is the player’s entry point: it presents a game title and can wait for Fire before play begins. It can also introduce enemies, high scores, settings, extra information, or a demo sequence. section 1.5.2

On the NES, an intro screen is assembled from fixed 8 × 8 tile patterns loaded from ROM into video memory. Sprites can add smaller objects in front of or behind the tiled background. section 1.5.2

A simple title-screen implementation proceeds as follows:

  • Wait for rendering to finish and disable rendering before changing PPU video memory. section 6.7
  • Clear the nametable, then set PPU addresses for the title and prompt locations. section 6.7
  • Write zero-terminated text strings through a reusable text-writing routine, then update the PPU to show the result. section 6.7
  • Run a loop that waits for controller input; while waiting, it may animate, play music, or advance to another information screen. section 1.5.2

Mega Blast title screen

A minimal screen clears the display, writes “M E G A B L A S T” near the top, writes “PRESS FIRE TO BEGIN” lower down, and uses attribute-table data to apply palette sections. After it is displayed, the program enables background and sprite rendering and enters its main loop. section 6.7

Listing 6.16 Completing the display title screen function (megablast.s)
.segment "ZEROPAGE"
 
paddr: .res 2                                              #1
 
.segment "CODE"
title_text:
.byte "M E G A  B L A S T",0
 
press_play_text:
.byte "PRESS FIRE TO BEGIN",0
 
title_attributes:
.byte %00000101,%00000101,%00000101,%00000101
.byte %00000101,%00000101,%00000101,%00000101
 
.proc display_title_screen
    jsr ppu_off                                            #2
 
    jsr clear_nametable                                    #3
 
    vram_set_address (NAME_TABLE_0_ADDRESS + 4 * 32 + 6)   #4
    assign_16i text_address, title_text
    jsr write_text
 
    vram_set_address (NAME_TABLE_0_ADDRESS + 20 * 32 + 6)  #5
    assign_16i text_address, press_play_text
    jsr write_text
 
    vram_set_address (ATTRIBUTE_TABLE_0_ADDRESS + 8)       #6
    assign_16i paddr, title_attributes
    ldy #0
loop:
    lda (paddr),y
    sta PPU_VRAM_IO
    iny
    cpy #8
    bne loop
 
    jsr ppu_update                                         #7
 
    rts
.endproc

This listing shows the complete title-screen routine: clearing the nametable, positioning each text string, writing it, and filling attribute-table bytes for palette selection. section 6.7

How Classic Game Programming on the NES: Make your own retro video game covers it

How deep it goes
Builds a working NES title screen through PPU setup, nametable clearing, text writing, and palette attributes.
Examples
Uses a Mega Blast screen with title text, a Fire prompt, palette sections, and an NES emulator result.
What it assumes
Assumes an initialized NES console and defined tile patterns, then teaches screen construction from that point.
What you can do after
Build it from scratch as a simple NES title screen that displays text and prepares the game loop.
How it connects
Connects tile patterns, sprites, PPU video memory, nametables, palettes, controller input, and options screens.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Classic Game Programming on the NES: Make your own retro video game. The section links point to the parts of the book it draws on.