First off, this is the specific ROM that is being used. The checksums were found using HxD.
Pac-Man (USA) (Namco).nes
I found that RAM addresses $0067 and $0077 are the lives for players 1 and 2 respectively.
The code that writes the starting number of lives for the players is located at 0x00A9B in the ROM ($CA8B in RAM):
$CA8B:A9 03 LDA #$03
$CA8D:85 67 STA $67 = #$00
$CA8F:85 77 STA $77 = #$00
So, in the ROM file itself (not the RAM or PPU), you'll want to change ROM offset 0x00A9C
from 03 to 01
You can do this with a hex editor such as WindHex32
, or with a hex editor tool in a special emulator like FCEUX
By testing this change out, I confirmed that each player only starts out with 1 life, and as soon as each player dies, it's game over for them.
However, another factor to consider is how there's a possibility that a player's lives can increase, like when they reach a score of 10,000 points. Do you want to prevent a player from being able to earn extra lives, so that they'll only ever have one, and as soon as they lose that life, their game is over?
If yes, then the code that increases a player's lives is located at 0x02153 in the ROM ($E143 in RAM):
$E143:E6 67 INC $67 = #$03
Replace E6 67 with EA EA
. Now, the lives can never increase.
I can confirm that this code handles both players' possible life counter increases because of how the game handles which player is currently active and playing. It seems that, when player 1 dies, the game switches player 1's and 2's lives around so that the current player playing is using $0067. The following code is at 0x00DA6 in the ROM ($CD96 in RAM):
$CD96:B5 67 LDA $67,X @ $0067 = #$03 ; Load current player's remaining lives.
$CD98:85 00 STA $00 = #$02 ; Store here for later.
$CD9A:B5 77 LDA $77,X @ $0077 = #$03 ; Take other player's remaining lives.
$CD9C:95 67 STA $67,X @ $0067 = #$03 ; Replace as the active player.
$CD9E:A5 00 LDA $00 = #$02 ; Remember the other player?
$CDA0:95 77 STA $77,X @ $0077 = #$03 ; They have to wait for their turn again!
Enjoy, and best of luck with the carnival booth!