The last life, and what comes after it, the way Mario does

The lives lesson’s level, played to the end. Lose all three lives and watch what the game does with the last one: no lives screen this time, a GAME OVER screen that holds by itself, then a title that waits for Start. The program is 610 instructions in 1,576 bytes, built and checked the same way.

Play it here Change it on the desk The cartridge, to play anywhere that plays NES cartridges: gameover.nes

On the screen

frame 50
frame 50
frame 600
frame 600
frame 850
frame 850
frame 950
frame 950

The last death skips a screen and adds two

In Super Mario Bros. the last life goes the way every life goes, the freeze, the hop and the fall, but what follows is different: the picture is cleared for GAME OVER instead of the lives screen, that screen holds for about seven seconds with nothing to press, and then the title is drawn again, with the lives back to what a new game starts with. Start on the title goes through the usual card into the level. This cartridge does the same with its own screens, its own timings and its own words.

this cartridgeSuper Mario Bros.
frames from the last touch to the GAME OVER screen55211
tiles that screen is written with, besides its clear9105
frames it holds before the title255422
tiles the title is written with191,794
frames from Start on the title to play1168
the lives are what a new game starts withyesyes

As written

The part of the program this lesson is about. The whole program is a plain text file: gameover.s

;; The screen between rounds, drawn with the picture off: both tables
;; empty, every sprite out of sight, and a line of words in the middle,
;; LIVES and the count for 120 frames, or GAME OVER with none left, which
;; stays 255 frames before the title.
lives:
    JSR wipe
    LDA #$21
    STA $2006
    LDA #$CC
    STA $2006
    LDA $52
    BEQ gameover
    LDX #$00
word1:
    LDA livesword,X
    STA $2007
    INX
    CPX #$06
    BNE word1
    LDA $52
    CLC
    ADC #$2A
    STA $2007
    LDA #$03
    STA $50
    LDA #$78
    STA $51
    JMP shown
gameover:
    LDX #$00
word2:
    LDA overword,X
    STA $2007
    INX
    CPX #$09
    BNE word2
    LDA #$04
    STA $50
    LDA #$FF
    STA $51
shown:
    LDA #$00
    STA $2005
    STA $2005
    LDA #$1E
    STA $2001
    RTS
;; The title, drawn the same way: its two lines of words, OUR GAME above
;; and PRESS START below, and then it waits.
titlescreen:
    JSR wipe
    LDA #$21
    STA $2006
    LDA #$8C
    STA $2006
    LDX #$00
word3:
    LDA ourword,X
    STA $2007
    INX
    CPX #$08
    BNE word3
    LDA #$22
    STA $2006
    LDA #$0B
    STA $2006
    LDX #$00
word4:
    LDA startword,X
    STA $2007
    INX
    CPX #$0B
    BNE word4
    LDA #$06
    STA $50
    LDA #$00
    STA $2005
    STA $2005
    LDA #$1E
    STA $2001
    RTS
;; The picture off, both tables emptied, every sprite out of sight.
wipe:
    LDA #$00
    STA $2001
    LDA #$20
    STA $2006
    LDA #$00
    STA $2006
    TAX
    LDY #$04
wipe2:
    STA $2007
    INX
    BNE wipe2
    DEY
    BNE wipe2
    LDA #$FF
hide2:
    STA $0200,X
    INX
    BNE hide2
    RTS
;; LIVES and a space, GAME OVER, OUR GAME and PRESS START, in our letters.
livesword:
    .byte $1B,$18,$25,$14,$22,$00
overword:
    .byte $16,$10,$1C,$14,$00,$1E,$25,$14,$21
ourword:
    .byte $1E,$24,$21,$00,$16,$10,$1C,$14
startword:
    .byte $1F,$21,$14,$22,$22,$00,$22,$23,$10,$21,$23

Before this one: Falling into a hole, the way Mario does

Next: An item screen the picture slides away to show, the way Zelda's does

All the lessons