Tetris (NES, Tengen)
Tengen's unlicensed 1989 Tetris for the NES, read through zohassadar's disassembly.
On this page
The atlas reads Tengen’s Tetris through zohassadar’s TengenTetrisDisasm, which is only partly labeled. Nothing here has been measured in the ROM, and the atlas has no copy of it to check the build against.
#Dealing pieces
The piece randomizer has no memory. Each pick steps a 16-bit generator five times and keeps three bits, rerolling only a 0, with no check against the piece before1. Nintendo’s NES Tetris rerolls against repeats2.
Each player has a generator, and both start from the same seed, so in a two-player game both get the same pieces in the same order3.
Mechanics
| Mechanic | Kind | How |
|---|---|---|
| Piece randomizer | Memoryless | three bits of a 16-bit generator, rerolled only on 0; both players get the same pieces |
Every claim about this game, by concept (2)
References
- ^
getNextTetrominosteps the player's 16-bit generator five times and keeps the low three bits, trying again only when they are 0; the result, 1 to 7, is the next piece, with no check against the piece before.Codezohassadar/TengenTetrisDisasmHow we know
lda player1TetrominoNext,x … sta player1TetrominoCurrent,x … adc #player1RNGSeed … jsr genNextPseudoRandom5x … and #$07 … beq @loopUntilNotZero … sta player1TetrominoNext,x
main.asm#L3693-L3705 · upstream ↗ 3805genNextPseudoRandom5x: ⋮ 3819genNextPseudoRandom:
main.asm lines 3805–3832 at df38b4f · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^
pickRandomTetriminoadds a pick counter to the generator's high byte and keeps the low 3 bits; a result of 7, or the same piece as last time, makes it step the generator and take the high byte's low 3 bits plus the previous piece's orientation id, modulo 7, with no further check.CodeCelestialAmber/TetrisNESDisasm · Birken, "Applying AI to Nintendo Tetris"How we know
2974 inc spawnCount 2975 lda rng_seed 2976 clc 2977 adc spawnCount 2978 and #$07 2979 cmp #$07 2980 beq @invalidIndex 2981 tax 2982 lda spawnTable,x 2983 cmp spawnID 2984 bne useNewSpawnID 2985@invalidIndex: ⋮
main.asm lines 2974–3002 at 94581c0 · upstream ↗ 3013spawnTable: 3014 .byte tDown, jDown, zHoriz, oFixed, sHoriz, lDown, iHoriz
main.asm lines 3013–3014 at 94581c0 · upstream ↗ Otherwise, the next pseudorandom number is generated and a mask is applied to retain the lower 3 bits of the high byte before adding the prior spawn orientation ID.
Picking Tetriminos · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^At the start of a game both players' generators are loaded with the same seed, and only
getNextTetrominosteps them, so in a two-player game both players get the same sequence of pieces. The shared seed itself is stepped on every pass of the main loop before the game.Codezohassadar/TengenTetrisDisasmHow we know
lda rngSeed … sta player1RNGSeed … sta player2RNGSeed … lda rngSeed+1 … sta player1RNGSeed+1 … sta player2RNGSeed+1
main.asm#L3319-L3326 · upstream ↗ 48mainLoop:main.asm lines 48–50 at df38b4f · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
Sources
Code
- zohassadar. 2024. “Tengen NES Tetris Disassembly.” Commit df38b4f. zohassadar/TengenTetrisDisasm @ df38b4f · licence, all uses
- (CelestialAmber), Amber Brault and contributors. 2024. “TetrisNESDisasm: a disassembly of Tetris (NES).” Commit 94581c0. CelestialAmber/TetrisNESDisasm @ 94581c0 · licence, all uses
Secondary
- Birken, Michael. 2014. “Applying Artificial Intelligence to Nintendo Tetris.” original · archived · licence, all uses