### How to make NES passwords

Posted:

**December 23rd, 2017, 11:08 am**I could not find any information on the web about how to make passwords for PoP1 NES.

So here is what I found out:

The password consists of 8 decimal digits:
How to calculate the checksum:

Start with 0, and then add the digits together from #1 to #8.

When you reach the checksum digits (#5 and #7), you need to use the *current* value of the checksum, mod or div 10!

Other points of interest:

* The hit points are not stored in the password. Instead they depend on the current level:
These seem to match the guards' hitpoints on each level.

* The game accepts passwords for level 15 and 16.

These will load some garbage levels. Screenshots here: http://popuw.com/nes.html

On these levels, the D-pad doesn't work, but the A and B buttons do work.

* The level number is masked to four bits, so level 17 is level 1, level 18 is level 2, and so on.

* Minutes can be anything from 00 to 99, even though the game starts with 60 minutes left.

* The remaining seconds or ticks are not stored in the password.

Passwords with 0 minutes left sometimes immediately show the bad ending, sometimes the *same* password gives about half minutes of time.

Sometimes the bad ending appears while the prince is running towards the exit in the password room!

* The purpose of the "anything" digits is probably to make the structure of the password less apparent.

* There are at least five versions of the game: Europe (E), France (F), Germany (G), Spain (S), USA (U).

This information applies to all of them.

* The game considers the password 00000000 to be invalid, even though it would be a valid password for level 1 with 0 minutes left.

* The game decodes the level number in the following way:
The important part is that it uses bitwise or instead of addition.

This is important only for custom-made passwords, because the game always makes passwords that result in level_high and level_low both to be within 0..3, and in that case, the two operations are equivalent.

So here is what I found out:

The password consists of 8 decimal digits:

Code: Select all

```
Digit #1: (minutes div 10 + digit #3) mod 10
Digit #2: ((level - 1) mod 4 + digit #3) mod 10
Digit #3: anything
Digit #4: (minutes mod 10 + digit #6) mod 10
Digit #5: checksum mod 10
Digit #6: anything
Digit #7: checksum div 10
Digit #8: ((level - 1) div 4 + digit #6) mod 10
```

Start with 0, and then add the digits together from #1 to #8.

When you reach the checksum digits (#5 and #7), you need to use the *current* value of the checksum, mod or div 10!

Other points of interest:

* The hit points are not stored in the password. Instead they depend on the current level:

Code: Select all

```
Level 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Hit points 3 3 3 3 3 4 4 4 4 5 5 5 4 5
```

* The game accepts passwords for level 15 and 16.

These will load some garbage levels. Screenshots here: http://popuw.com/nes.html

On these levels, the D-pad doesn't work, but the A and B buttons do work.

* The level number is masked to four bits, so level 17 is level 1, level 18 is level 2, and so on.

* Minutes can be anything from 00 to 99, even though the game starts with 60 minutes left.

* The remaining seconds or ticks are not stored in the password.

Passwords with 0 minutes left sometimes immediately show the bad ending, sometimes the *same* password gives about half minutes of time.

Sometimes the bad ending appears while the prince is running towards the exit in the password room!

* The purpose of the "anything" digits is probably to make the structure of the password less apparent.

* There are at least five versions of the game: Europe (E), France (F), Germany (G), Spain (S), USA (U).

This information applies to all of them.

* The game considers the password 00000000 to be invalid, even though it would be a valid password for level 1 with 0 minutes left.

* The game decodes the level number in the following way:

Code: Select all

```
level_high := (digit #8 - digit #6 + 10) mod 10;
level_low := (digit #2 - digit #6 + 10) mod 10;
level := ((level_high * 4) or level_low) mod 16;
level := level + 1;
```

This is important only for custom-made passwords, because the game always makes passwords that result in level_high and level_low both to be within 0..3, and in that case, the two operations are equivalent.