EnoughLives

by mrmeyham

Game: SMW

Description: Plenty of lives, but count down is a thing

; Mario lives (2 player game)
!mario_lives = $7E0DB4
; Luigi lives (2 player game)
!luigi_lives = $7E0DB5
; Current lives (1 player game)
!cur_lives = $7E0DBE
; Two player game flag (00 = no, 01 = yes)
!players = $7E0DB2

LDA !players
CMP #$01
BNE oneplayer

; Two-player mode. Check both addresses lazily.
LDA !mario_lives
CMP #$04
BCS luigi

LDA #$04
STA !mario_lives

luigi:
LDA !luigi_lives
CMP #$04
BCS end

LDA #$04
STA !luigi_lives
JMP end

oneplayer:
; If < 5 lives, set lives to 5
LDA !cur_lives
CMP #$04
BCS end

LDA #$04
STA !cur_lives

end:
RTL
back to listings