Tetris (USA)

Tetris (USA) is on a MMC1 board with 32,768 bytes of program. A crawl of 6,400 steps from power-on kept 54 paths that found new code. Played back over 181,254 frames, they executed 6,318 bytes of it, 19 percent.

What the rules named

The 121 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, and their names in the listing say what they are: a poll, an engine, a drain.

atits name in the listingentered bytimeswhat it is, and the evidence
$AC82 (bank 0)b0_engine_AC82a call194,840
The jump engine: tables 4, jumps through them 194,840
$AB69 (bank 0)b0_poll_AB69a call110,004
The poll: port $4016, reads a frame 16, strobes a frame 4
The poll: port $4017, reads a frame 16, strobes a frame 4
$AC6A (bank 0)b0_sprites_AC6Aa call60,749
The sprite writers: frames it ran in 54,948, writes to the sprite page 15,521,454
$AB47 (bank 0)b0_random_AB47a call60,684
The random byte: frames it ran in 55,002, bytes $0017,$0018, rotates 2, exclusive-ors 1
$8005 (bank 0)b0_nmieach frame (NMI)55,002
The scroll writer: frames it ran in 55,002, writes in the blank 109,960
$E000 (bank 1)b1_sound_E000a call55,002
The sound driver: frames it ran in 54,734, writes 55,002
$82B1 (bank 0)b0_dispatch_82B1a table37,643
The scroll writer: frames it ran in 37,643, writes in the blank 75,286
$9725 (bank 0)b0_drain_9725a call36,688
The picture writer: frames it ran in 9,172, writes 26,800, in the blank 26,800, while drawing 0
$8C27 (bank 0)b0_sprites_8C27a call18,224
The sprite writers: frames it ran in 11,732, writes to the sprite page 199,848
$ACB7 (bank 0)b0_bank_ACB7a call9,574
The bank switch: writes 47,870, in the blank 1,100, while drawing 46,770
$ACCB (bank 0)b0_bank_ACCBa call9,574
The bank switch: writes 47,870, in the blank 1,100, while drawing 46,770
$94EE (bank 0)b0_dispatch_94EEa table9,360
The palette writers: frames it ran in 9,360, writes 9,360
$8A0A (bank 0)b0_sprites_8A0Aa call9,304
The sprite writers: frames it ran in 9,304, writes to the sprite page 150,282
$8BCE (bank 0)b0_sprites_8BCEa call9,304
The sprite writers: frames it ran in 9,304, writes to the sprite page 148,560
$AA98 (bank 0)b0_palette_AA98a call493
The palette writers: frames it ran in 468, writes 4,393
$ACA3 (bank 0)b0_bank_ACA3a call140
The bank switch: writes 700, in the blank 270, while drawing 430
$ACDF (bank 0)b0_bank_ACDFa call54
The bank switch: writes 270, in the blank 270, while drawing 0
$FF00 (bank 1)b1_resetpower-on54
The bank switch: writes 108, in the blank 108, while drawing 0
The sprite writers: frames it ran in 9,870, writes to the sprite page 13,824
$82D1 (bank 0)b0_dispatch_82D1a table50
The bank switch: writes 100, in the blank 0, while drawing 100
$83D7 (bank 0)b0_dispatch_83D7a table36
The bank switch: writes 72, in the blank 0, while drawing 72
$9808 (bank 0)b0_palette_9808a call22
The palette writers: frames it ran in 22, writes 176
$AB8B (bank 0)a call110,001
$8161 (bank 0)a call65,364
$819B (bank 0)a call65,170
$815D (bank 0)a table65,168
$804B (bank 0)a call55,002
$9D51 (bank 0)a call55,002
$AB5E (bank 0)a call55,002
$AB9D (bank 0)a call55,002
$AA2F (bank 0)a call54,458
$E194 (bank 1)a call50,624
$E19C (bank 1)a call50,624
$E1AC (bank 1)a call50,624
$E1B9 (bank 1)a call50,624
$E583 (bank 1)a call50,624
$E5D0 (bank 1)a call29,077
$E766 (bank 1)a call29,077
$8174 (bank 0)a table9,304
$8186 (bank 0)a table9,304
$81B2 (bank 0)a call9,304
$8776 (bank 0)a call9,304
$87AE (bank 0)a call9,304
$8884 (bank 0)a table9,304
$9CBF (bank 0)a table9,304
$9E16 (bank 0)a table9,304
$A37F (bank 0)a table9,304
$9874 (bank 0)a call9,302
$9E27 (bank 0)a table9,302
$81CF (bank 0)a table8,367
$88AB (bank 0)a call8,367
$8914 (bank 0)a call8,367
$89AE (bank 0)a call8,367
$85DA (bank 0)a table7,999
$E735 (bank 1)a call7,897
$EA41 (bank 1)a call5,058
$E072 (bank 1)a call4,509
$E0B5 (bank 1)a call4,013
$948B (bank 0)a call1,733
$84AE (bank 0)a call1,526
$9712 (bank 0)a call1,432
$E481 (bank 1)a table1,282
$E39C (bank 1)a table1,011
$9DE8 (bank 0)a call824
$E04B (bank 1)a call668
$E3DD (bank 1)a table646
$E3B3 (bank 1)a table552
$AA45 (bank 0)a call544
$E9EB (bank 1)a call509
$EA03 (bank 1)a call509
$AB21 (bank 0)a call493
$E637 (bank 1)a call446
$E271 (bank 1)a call363
$E425 (bank 1)a table360
$E33B (bank 1)a call339
$9A6B (bank 0)a table309
$AA52 (bank 0)a call270
$AA5F (bank 0)a call270
$AA6B (bank 0)a call270
$AA78 (bank 0)a call270
$AA8A (bank 0)a call270
$E253 (bank 1)a call255
$E390 (bank 1)a table217
$AA82 (bank 0)a call216
$AC1C (bank 0)a call216
$E003 (bank 1)a call198
$977F (bank 0)a call188
$9E39 (bank 0)a table178
$988E (bank 0)a table142
$9CAF (bank 0)a call135
$9D17 (bank 0)a call133
$98EB (bank 0)a call110
$99A2 (bank 0)a table110
$E287 (bank 1)a call110
$E473 (bank 1)a table110
$9E07 (bank 0)a call107
$E247 (bank 1)a call104
$E6D7 (bank 1)a call104
$E3CA (bank 1)a table93
$9969 (bank 0)a call88
$E417 (bank 1)a call86
$E43B (bank 1)a table86
$9B03 (bank 0)a table66
$9B58 (bank 0)a table66
$A3F2 (bank 0)a table66
$E3D1 (bank 1)a table66
$E384 (bank 1)a table56
$8200 (bank 0)a table54
$824F (bank 0)a table54
$A459 (bank 0)a call54
$E006 (bank 1)a call54
$E244 (bank 1)a call54
$9907 (bank 0)a call48
$9FF2 (bank 0)a call36
$85F0 (bank 0)a table22
$86DC (bank 0)a table22
$87DC (bank 0)a call22
$E41A (bank 1)a table14
$E40E (bank 1)a table10
$E42E (bank 1)a table4
$9DF6 (bank 0)a table2
$E403 (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.

atits name in the listingwhat it is, and the evidence
$828D (bank 0)b0_wait_828D
The wait for the frame: waits on the byte at $00F5, times entered 54, turns 6,257, calls on each turn 1, writes of it under the frame interrupt 1,987,495, frames in all 55,254
$A45B (bank 0)b0_wait_A45B
The wait for the frame: waits on the byte at $00C3, times entered 54, turns 13,470, calls on each turn 1, writes of it under the frame interrupt 192,960, frames in all 55,254
$AA37 (bank 0)b0_wait_AA37
The wait for the frame: waits on the byte at $0033, times entered 54,458, turns 214,054,962, writes of it under the frame interrupt 55,002, frames in all 55,254
$AA4D (bank 0)b0_wait_AA4D
The wait for the frame: waits on the byte at $0033, times entered 544, turns 2,062,901, writes of it under the frame interrupt 55,002, frames in all 55,254

The tables it jumps through

A table of addresses the game picks one from. Some sit right after a call to a jump engine; others are anywhere in the cartridge, and we find them by where the address the game jumped through was loaded from. Some games jump by pushing an address and returning to it, and some keep a table as two, the low bytes of its addresses in one place and the high bytes in another; both are found the same way. 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.

atreachedentriestakenchosen by the byte at
$8050 (bank 0)after a call43$00BD
$8166 (bank 0)after a call76$00C0
$81A0 (bank 0)after a call99$00A7
$81B7 (bank 0)after a call108$0068
$E015 (bank 1)through a pointer2015

The memory its routines share

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

004080C0$0000$0100$0200$0300$0400$0500$0600$0700
The console's 2,048 bytes of memory, one row for each 256. A tick under a row is one of the 24 busiest shared bytes. The second row is the page the processor keeps its stack in. Reaches through an index that belong to no table are not drawn: the loops that clear memory reach nearly every byte.

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

frombytes reachedinstructionspositions it holds
$04002014
$05002012
$0700802
$02003210
$0040322
$0060322
$0000252
$0001241
$0730213
$03EF161
$03F0133
$03F1131

The 24 busiest shared bytes

bytereads and writesroutines writingroutines reading
$000120,022,88066
$000020,021,49466
$00F53,633,96356
$0040641,25846
$0060614,13033
$00A7307,41066
$00E0242,90466
$00F7210,52435
$00ED204,16556
$00C0195,84366
$06F1152,55163
$0017152,20025
$06F5152,08933
$06F0151,98023
$06F2151,98023
$06F3151,98023
$00B1122,50026
$00FB110,11212
$00FF109,10466
$004985,52566
$06FD80,31634
$00A077,42953
$00A177,42953
$00EE73,29625

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

All the games