Coin limit

A **coin limit** is the maximum number of coins that can be collected or saved in a given area. Some courses allow infinite coins to be collected. However, in the NTSC (American) version, the coin counter is programmed to stay at the maximum of 999.

There are two types of coin limits - the 999 coin limit within the course (except Japanese version), and the 255 coin limit that is saved in the save-able records.

## The 999 coin limit

The limit is intentionally put in by the programmers to prevent the game to count up coins greater than 999:

```
if(coin_counter > 999) {
coin_counter := 999;
}

```

## The 255 coin limit

Separately, there is an unintentional coin limit involving the saved coin score. This value overflows and is set to 0 if the number of coins Mario collected in the course is a multiple of 256. (Not within the course, but when recording the saved coin score after Mario exits the course.) Thus, the easiest way to obtain the highest possible saved coin score in a level is to simply collect 255 coins. 511 and 767 also produce a saved coin score of 255, but collecting more than 255 coins is not as efficient as collecting a star when 255 coins have been collected. 1,023, 1,279, etc. also save as 255, but these coin scores cannot be obtained in the NTSC version.

## Coin limit for each course

Normally, the number of available coins in the course prevents the player from getting an excess number of coins to reach either of the coin limits. Nonetheless, there are ways for a player to perform infinite coin glitches such as moneybag duplication, cloning or utilizing certain exploits of the game, allowing infinite coin glitches in certain courses.

Some courses have only a finite number of coins; in these courses, cloning is impossible and there are no infinite coin glitches. The three courses that don't fall into either of these categories, namely Tick Tock Clock, Rainbow Ride, and Bowser in the Fire Sea, allow for clones to be created, but due to a lack of loading zones, the clones fill up the game's object slots. Due to this, there is a limitation of the number of coins that can be collected within these three courses.

In the table below, 999 coins represent stages with infinite coin glitches available that does not have clones occupy object slots making the game crash.

## Unbounded Coin Limit Glitch (Japanese version)

In the Japanese version, there is no coin limit within the courses. When the coin counter reaches a value of 1,000, the game runs a few lines of code wherein there is a typo:

```
if(coin_counter > 999) {
lives_counter := 999;
}

```

This should be the following:

```
if(coin_counter > 999) {
coin_counter := 999;
}

```

Because the lives counter is a signed short, the value of 999 overflows to -25. This is displayed in the HUD as "M25." (The "M" presumably means "minus.")

The coin display on the HUD freezes at the value 32,767. After that, only the coin count is the only incrementing value. Because the coin count is not limited, the player can obtain an in-course coin count of 65,535. If the player collected one more coin while the game was in this state, the coin counter would overflow and be set to 0. If one were to collect a 65,636th coin (65,536 for the overflow and 100 for the star), a second 100 coin star would spawn. This was a part of a strategy that could have been implemented in reducing "To the Top of the Fortress" to 0x, but it wasn't because a faster 0x strategy was discovered for that star.