Reprogramming NES Tetris: A Hacker’s Delight
Thirty-four years after its release, the iconic Nintendo Entertainment System (NES) game Tetris continues to fascinate and challenge players. Recently, hackers have discovered a remarkable way to reprogram the game from within its own code, opening up a world of possibilities for customizing and enhancing the classic experience.
Memory Manipulation and Controller Inputs
The ability to reprogram NES Tetris stems from a specific crash that occurs when the game’s score handler takes too long to calculate a new score between frames. During this crash, a portion of the control code gets interrupted, causing it to jump to an unintended portion of the game’s RAM for the next instruction.
Crucially, the Famicom version of the NES features an extra controller port. The Tetris game code reads the inputs from this port, even when the player is not using it. This allows hackers to manipulate the RAM that the game uses to process these inputs, effectively controlling where the game code goes after the crash is triggered.
Coding in the High-Score Table
By holding down specific button combinations on the extra controllers, hackers can send the jump code to an area of RAM that holds the names and scores for the game’s high score listing. This provides a larger surface of RAM that can be manipulated directly by the player.
Unfortunately, only a limited number of symbols and digits can be used in the high score table. This means that only a small portion of the NES’s available opcode instructions can be “coded” into it. Despite these restrictions, hackers have managed to create short code snippets that can be translated into high-score table data.
Proof of Concept and Future Possibilities
As a proof of concept, one hacker was able to code a routine that puts two zeroes in the top digits of the game’s score, lowering the score processing time that would otherwise cause a crash. This innovative hack demonstrates the potential for reprogramming NES Tetris from within the game itself.
While the limited space in the high score table poses a challenge for coding complex programs, hackers are already exploring ways to overcome this limitation. By building bootstrappers within the high-score table, it may be possible to gain full control over all of RAM and reprogram Tetris in ways that were previously unimaginable.
The discovery of this reprogramming technique has opened up exciting new possibilities for NES Tetris enthusiasts. From eliminating crash bugs to creating entirely new gameplay experiences, the hackers’ mastery of memory manipulation and controller inputs has breathed new life into this timeless classic.