Tetris (USA)

Tetris (USA) is on a MMC1 board with 32,768 bytes of program. A crawl of 400 steps from power-on kept 33 paths that found new code. Played back over 32,313 frames, they executed 5,371 bytes of it, 16 percent.

What the rules named

The 111 routines the runs entered

Every place the game's code was entered, by a call, an interrupt or a jump through a table. The ones a rule named come first, with what the rule saw.

atentered bytimeswhat it is, and the evidence
$AB69 (bank 0)a call43,322
The poll: port $4016, reads a frame 16, strobes a frame 4
The poll: port $4017, reads a frame 16, strobes a frame 4
$AC82 (bank 0)a call30,073
The jump engine: tables 4, jumps through them 30,073
$AB47 (bank 0)a call24,059
The random byte: frames it ran in 21,661, bytes $0017,$0018, rotates 2, exclusive-ors 1
$AC6A (bank 0)a call22,895
The sprite writers: frames it ran in 21,628, writes to the sprite page 5,842,818
$8005 (bank 0)each frame (NMI)21,661
The scroll writer: frames it ran in 21,661, writes in the blank 43,298
$E000 (bank 1)a call21,661
The sound driver: frames it ran in 21,500, writes 21,661
$82B1 (bank 0)a table18,728
The scroll writer: frames it ran in 18,728, writes in the blank 37,456
$8C27 (bank 0)a call3,403
The sprite writers: frames it ran in 1,977, writes to the sprite page 28,840
$9725 (bank 0)a call2,244
The picture writer: frames it ran in 561, writes 3,000, in the blank 3,000, while drawing 0
$ACB7 (bank 0)a call711
The bank switch: writes 3,555, in the blank 650, while drawing 2,905
$ACCB (bank 0)a call711
The bank switch: writes 3,555, in the blank 650, while drawing 2,905
$94EE (bank 0)a table561
The palette writers: frames it ran in 561, writes 561
$8A0A (bank 0)a call550
The sprite writers: frames it ran in 550, writes to the sprite page 8,811
$8BCE (bank 0)a call550
The sprite writers: frames it ran in 550, writes to the sprite page 8,496
$AA98 (bank 0)a call296
The palette writers: frames it ran in 276, writes 2,592
$ACA3 (bank 0)a call84
The bank switch: writes 420, in the blank 165, while drawing 255
$ACDF (bank 0)a call33
The bank switch: writes 165, in the blank 165, while drawing 0
$FF00 (bank 1)power-on33
The bank switch: writes 66, in the blank 66, while drawing 0
The sprite writers: frames it ran in 889, writes to the sprite page 8,448
$82D1 (bank 0)a table31
The bank switch: writes 62, in the blank 0, while drawing 62
$83D7 (bank 0)a table20
The bank switch: writes 40, in the blank 0, while drawing 40
$9808 (bank 0)a call12
The palette writers: frames it ran in 12, writes 96
$AB8B (bank 0)a call43,321
$804B (bank 0)a call21,661
$9D51 (bank 0)a call21,661
$AB5E (bank 0)a call21,661
$AB9D (bank 0)a call21,661
$E194 (bank 1)a call21,642
$E19C (bank 1)a call21,642
$E1AC (bank 1)a call21,642
$E1B9 (bank 1)a call21,642
$E583 (bank 1)a call21,642
$AA2F (bank 0)a call21,338
$E5D0 (bank 1)a call7,397
$E766 (bank 1)a call7,397
$8161 (bank 0)a call3,989
$815D (bank 0)a table3,873
$819B (bank 0)a call3,873
$85DA (bank 0)a table2,372
$E735 (bank 1)a call1,976
$EA41 (bank 1)a call1,391
$E072 (bank 1)a call1,379
$E0B5 (bank 1)a call1,256
$E481 (bank 1)a table756
$84AE (bank 0)a call706
$8174 (bank 0)a table550
$8186 (bank 0)a table550
$81B2 (bank 0)a call550
$8776 (bank 0)a call550
$87AE (bank 0)a call550
$8884 (bank 0)a table550
$9CBF (bank 0)a table550
$9E16 (bank 0)a table550
$A37F (bank 0)a table550
$9874 (bank 0)a call549
$9E27 (bank 0)a table549
$81CF (bank 0)a table530
$88AB (bank 0)a call530
$8914 (bank 0)a call530
$89AE (bank 0)a call530
$9712 (bank 0)a call440
$AA45 (bank 0)a call323
$AB21 (bank 0)a call296
$E3B3 (bank 1)a table294
$E271 (bank 1)a call201
$AA52 (bank 0)a call161
$AA5F (bank 0)a call161
$AA6B (bank 0)a call161
$AA78 (bank 0)a call161
$AA8A (bank 0)a call161
$E253 (bank 1)a call151
$E3DD (bank 1)a table150
$E04B (bank 1)a call137
$AA82 (bank 0)a call132
$AC1C (bank 0)a call132
$E9EB (bank 1)a call126
$EA03 (bank 1)a call126
$E003 (bank 1)a call118
$948B (bank 0)a call105
$E287 (bank 1)a call64
$E473 (bank 1)a table64
$9E07 (bank 0)a call49
$E247 (bank 1)a call49
$E3CA (bank 1)a table49
$E6D7 (bank 1)a call49
$E39C (bank 1)a table46
$8200 (bank 0)a table33
$A459 (bank 0)a call33
$E006 (bank 1)a call33
$E244 (bank 1)a call33
$824F (bank 0)a table32
$98EB (bank 0)a call26
$9907 (bank 0)a call26
$9FF2 (bank 0)a call20
$E33B (bank 1)a call20
$9969 (bank 0)a call14
$85F0 (bank 0)a table12
$86DC (bank 0)a table12
$87DC (bank 0)a call12
$E3D1 (bank 1)a table10
$E417 (bank 1)a call10
$9A6B (bank 0)a table8
$E390 (bank 1)a table8
$E637 (bank 1)a call6
$9CAF (bank 0)a call5
$988E (bank 0)a table4
$9D17 (bank 0)a call4
$99A2 (bank 0)a table2
$9B03 (bank 0)a table2
$9B58 (bank 0)a table2
$A3F2 (bank 0)a table2
$E384 (bank 1)a table2

Where it waits

Loops a rule named that sit inside a routine and are not themselves a place the code is entered.

atwhat it is, and the evidence
$828D (bank 0)
The wait for the frame: waits on the byte at $00F5, times entered 32, turns 2,277, calls on each turn 1, writes of it under the frame interrupt 779,777, frames in all 21,813
$A45B (bank 0)
The wait for the frame: waits on the byte at $00C3, times entered 33, turns 8,136, calls on each turn 1, writes of it under the frame interrupt 70,306, frames in all 21,813
$AA37 (bank 0)
The wait for the frame: waits on the byte at $0033, times entered 21,338, turns 86,515,130, writes of it under the frame interrupt 21,661, frames in all 21,813
$AA4D (bank 0)
The wait for the frame: waits on the byte at $0033, times entered 323, turns 1,223,757, writes of it under the frame interrupt 21,661, frames in all 21,813

The jump engine's tables

Each table sits right after a call to the engine. An entry is counted as far as the runs saw one taken; the true table may be longer. The last column is the byte of memory whose value picked the entry, where we could follow it: the game's mode, or what one of its objects is doing.

atentriestakenchosen by the byte at
$8050 (bank 0)43$00BD
$8166 (bank 0)65$00C0
$81A0 (bank 0)99$00A7
$81B7 (bank 0)97$0068

The memory its routines share

392 bytes of memory were written by one routine and read by another, and 44 places were reached through an index, which is what a table or a set of object slots in memory looks like.

Reaches through an index: those that hold positions, then the longest

frombytes reachedinstructionspositions it holds
$0700802
$02003210
$0040322
$0060322
$0000252
$0001241
$03EF161
$03F0133
$03F1131
$0690101
$068093
$073093

The 24 busiest shared bytes

bytereads and writesroutines writingroutines reading
$00007,465,96166
$00017,461,99366
$00F51,407,82546
$00E096,00766
$00ED85,01356
$001768,78424
$06F165,12963
$06F565,04133
$06F064,99223
$06F264,99223
$06F364,99223
$00F753,64225
$00FF52,93666
$00B145,43824
$00FB43,38812
$004037,97346
$006036,33633
$00C030,61556
$06FD29,40734
$00BD22,40663
$06F922,29566
$06F822,13624
$06FA22,01023
$06FB22,01023

This page shows none of the game's bytes. The listing these figures were read from stays with the cartridge.

All the games