577
edits
No edit summary |
m (fixed wikitext typo) |
||
Line 25: | Line 25: | ||
Because the coin count can exceed 999, using [[Infinite Coin Glitches|infinite coin glitches]], it can reach 32767. Due to signed integer overflow, if one more coin is collected, the coin counter would become -32768. Collecting coins will continue to increase this value. Note that the coin display would remain 32767, for it only updates when it is less than the coin count. If one collects 32868 more coins, or 65636 coins in total, the coin counter will equal 100, spawning another 100 Coin Star. Although this star will appear yellow, collecting it will not increase the game's star count from 120 to 121 or more. This is because each star is represented in memory by 1 bit, and when a star is collected, the game uses the bitwise OR operator to store this information. | Because the coin count can exceed 999, using [[Infinite Coin Glitches|infinite coin glitches]], it can reach 32767. Due to signed integer overflow, if one more coin is collected, the coin counter would become -32768. Collecting coins will continue to increase this value. Note that the coin display would remain 32767, for it only updates when it is less than the coin count. If one collects 32868 more coins, or 65636 coins in total, the coin counter will equal 100, spawning another 100 Coin Star. Although this star will appear yellow, collecting it will not increase the game's star count from 120 to 121 or more. This is because each star is represented in memory by 1 bit, and when a star is collected, the game uses the bitwise OR operator to store this information. | ||
Since Mario's life count is stored as an 8-bit signed byte, when it is set to 999, the upper byte is discarded and the number that is stored is -25. Since the above code runs every frame, Mario's life count is constantly set to -25. This means collecting [[1-Up Mushroom | Since Mario's life count is stored as an 8-bit signed byte, when it is set to 999, the upper byte is discarded and the number that is stored is -25. Since the above code runs every frame, Mario's life count is constantly set to -25. This means collecting [[1-Up Mushroom|1-Ups]] will not change this value. Since Mario's coin count is not reset when he exits a level, losing a life will also not change the life count until another main course is entered. However, once Mario's coin count becomes negative, the life counter can be modified again. | ||
==Uses== | ==Uses== |
edits