Metroid (USA)

Metroid (USA) is on a MMC1 board with 131,072 bytes of program. A crawl of 400 steps from power-on kept 22 paths that found new code. Played back over 12,802 frames, they executed 6,967 bytes of it, 5 percent.

What the rules named

The 193 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
$C1E0 (bank 7)a call1,940
The palette writers: frames it ran in 1,962, writes 1,571
The picture writer: frames it ran in 1,962, writes 16,971, in the blank 3,243, while drawing 13,728
$C215 (bank 7)a call1,940
The poll: port $4017, reads a frame 8, strobes a frame 2
$C21F (bank 7)a call1,940
The poll: port $4016, reads a frame 8, strobes a frame 2
$C29A (bank 7)a call1,940
The scroll writer: frames it ran in 1,936, writes in the blank 3,828
$C4D9 (bank 7)a call1,940
The bank switch: writes 9,700, in the blank 9,570, while drawing 130
$C27C (bank 7)a call1,820
The jump engine: tables 4, jumps through them 1,820
$B3B4 (bank 0)a call1,761
The sound driver: frames it ran in 1,804, writes 1,761
$C1A3 (bank 7)a call936
The sprite writers: frames it ran in 936, writes to the sprite page 240,896
$C30C (bank 7)a call720
The palette writers: frames it ran in 724, writes 168
$9147 (bank 0)a table672
The sprite writers: frames it ran in 682, writes to the sprite page 2,496
$C1BC (bank 7)a call452
The sprite writers: frames it ran in 456, writes to the sprite page 43,392
$90D7 (bank 0)a table426
The sprite writers: frames it ran in 426, writes to the sprite page 1,704
$C4EF (bank 7)a call238
The bank switch: writes 1,190, in the blank 340, while drawing 850
$C9D7 (bank 7)a table200
The sprite writers: frames it ran in 200, writes to the sprite page 96
$C7AB (bank 7)a call188
The bank switch: writes 940, in the blank 100, while drawing 840
$C4E8 (bank 7)a call26
The bank switch: writes 130, in the blank 0, while drawing 130
$C4B2 (bank 7)a call22
The bank switch: writes 110, in the blank 0, while drawing 110
$C4FA (bank 7)a call22
The bank switch: writes 110, in the blank 110, while drawing 0
$C5D7 (bank 7)a call22
The bank switch: writes 110, in the blank 110, while drawing 0
$FFB0 (bank 7)an interrupt (IRQ)22
The bank switch: writes 308, in the blank 308, while drawing 0
The sprite writers: frames it ran in 2,002, writes to the sprite page 5,632
$C6D6 (bank 7)a call16
The bank switch: writes 80, in the blank 0, while drawing 80
$8071 (bank 0)a table4
The sprite writers: frames it ran in 8, writes to the sprite page 640
$C20E (bank 7)a call4
The split: frames it ran in 8, scroll writes while drawing 8, status reads while drawing 148
$C5DC (bank 7)a call4
The bank switch: writes 20, in the blank 0, while drawing 20
$C604 (bank 7)a call4
The bank switch: writes 20, in the blank 0, while drawing 20
$B4BD (bank 0)a call17,292
$C36B (bank 7)a call12,632
$BC53 (bank 0)a call5,220
$B4EE (bank 0)a table5,027
$B4BD (bank 1)a call2,323
$C2A8 (bank 7)a call2,047
$C0D9 (bank 7)each frame (NMI)1,998
$C97E (bank 7)a call1,976
$C2CA (bank 7)a call1,940
$C44D (bank 7)a call1,940
$C4DE (bank 7)a call1,814
$C000 (bank 7)a call1,792
$C114 (bank 7)a call1,792
$C266 (bank 7)a call1,792
$B31B (bank 0)a call1,757
$B322 (bank 0)a table1,757
$B34B (bank 0)a call1,745
$B33D (bank 0)a call1,740
$BC36 (bank 0)a call1,740
$BC3D (bank 0)a table1,740
$BC4B (bank 0)a table1,740
$BC64 (bank 0)a call1,740
$B35C (bank 0)a table1,734
$9A07 (bank 0)a call1,720
$B344 (bank 0)a table1,705
$B329 (bank 0)a call1,687
$B330 (bank 0)a table1,687
$B364 (bank 0)a table1,687
$C318 (bank 7)a call1,330
$BA08 (bank 0)a call920
$BA41 (bank 0)a call920
$B4EE (bank 1)a table697
$BC53 (bank 1)a call697
$B9F3 (bank 0)a call460
$BA37 (bank 0)a call460
$812C (bank 0)a table437
$EF9E (bank 7)a call416
$BA41 (bank 1)a call406
$B31B (bank 1)a call236
$B322 (bank 1)a table236
$B34B (bank 1)a call236
$B3B4 (bank 1)a call236
$C7D5 (bank 7)a call234
$BC64 (bank 1)a call233
$B33D (bank 1)a call232
$B344 (bank 1)a table232
$BC36 (bank 1)a call232
$BC3D (bank 1)a table232
$BC4B (bank 1)a table232
$B329 (bank 1)a call229
$B330 (bank 1)a table229
$B35C (bank 1)a table229
$B364 (bank 1)a table229
$B9F3 (bank 1)a call203
$BA08 (bank 1)a call203
$BA37 (bank 1)a call203
$C2BF (bank 7)a call191
$B4A9 (bank 0)a call157
$C434 (bank 7)a call148
$B7E7 (bank 0)a table102
$F1F4 (bank 7)a call92
$C158 (bank 7)a call86
$C16D (bank 7)a call86
$C376 (bank 7)a call77
$C3C6 (bank 7)a call60
$C2C5 (bank 7)a call48
$B6A1 (bank 0)a table47
$C439 (bank 7)a call42
$EAC0 (bank 7)a call40
$C487 (bank 7)a call38
$B493 (bank 0)a call37
$8FF1 (bank 0)a call36
$9001 (bank 0)a call36
$9011 (bank 0)a call36
$B4A2 (bank 0)a call36
$EB85 (bank 7)a call36
$EF8C (bank 7)a call36
$B36C (bank 0)a call35
$909F (bank 0)a call34
$9449 (bank 0)a call34
$B7D9 (bank 0)a table34
$C42C (bank 7)a call34
$C43D (bank 7)a call30
$C45D (bank 7)a call30
$C2B3 (bank 7)a call28
$C37E (bank 7)a call28
$EA2B (bank 7)a call24
$A93E (bank 0)a call22
$C531 (bank 7)a table22
$90BA (bank 0)a table18
$911A (bank 0)a table16
$940B (bank 0)a call16
$DF6B (bank 7)a call16
$DFA3 (bank 7)a call16
$EF09 (bank 7)a call16
$9450 (bank 0)a call13
$8A8C (bank 0)a call12
$E564 (bank 7)a call12
$ED7A (bank 7)a call12
$80B0 (bank 1)a call8
$B40E (bank 0)a call8
$B41D (bank 0)a call8
$B43E (bank 0)a call8
$B87F (bank 0)a table8
$C1D4 (bank 7)a call8
$C45C (bank 7)a table8
$C578 (bank 7)a call8
$E5E2 (bank 7)a table8
$EB06 (bank 7)a table8
$EB0C (bank 7)a call8
$EB28 (bank 7)a call8
$EB4D (bank 7)a call8
$EB7A (bank 7)a call8
$ED51 (bank 7)a call8
$ED8C (bank 7)a call8
$FB7B (bank 7)a call8
$8DDE (bank 0)a call6
$8E21 (bank 0)a call6
$8E4E (bank 0)a call6
$8F60 (bank 0)a call6
$80D0 (bank 0)a table4
$80F9 (bank 0)a table4
$8BD4 (bank 0)a call4
$8D12 (bank 0)a call4
$8D3D (bank 0)a call4
$B3FC (bank 0)a call4
$B3FC (bank 1)a call4
$B404 (bank 0)a call4
$B9E4 (bank 0)a call4
$B9E4 (bank 1)a call4
$BC7A (bank 0)a table4
$BC80 (bank 1)a table4
$BF19 (bank 0)a call4
$BF19 (bank 1)a call4
$C2C0 (bank 7)a call4
$C552 (bank 7)a table4
$C801 (bank 7)a table4
$C8B0 (bank 7)a call4
$C8BB (bank 7)a call4
$C8D1 (bank 7)a table4
$CA18 (bank 7)a call4
$CB8E (bank 7)a call4
$CBFD (bank 7)a call4
$E193 (bank 7)a call4
$E720 (bank 7)a call4
$EA05 (bank 7)a call4
$EA26 (bank 7)a table4
$EC93 (bank 7)a call4
$EC9B (bank 7)a call4
$ED5B (bank 7)a call4
$ED65 (bank 7)a call4
$ED98 (bank 7)a call4
$EF00 (bank 7)a call4
$EFF8 (bank 7)a call4
$F01C (bank 7)a call4
$8142 (bank 0)a table3
$B40E (bank 1)a call3
$B41D (bank 1)a call3
$B43E (bank 1)a call3
$B368 (bank 0)a call2
$B374 (bank 0)a call2
$B695 (bank 0)a table2
$CF6B (bank 7)a call2
$DC8F (bank 7)a call2
$DCC3 (bank 7)a call2
$DE3D (bank 7)a call2
$DFDF (bank 7)a call2
$B878 (bank 0)a table1

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
$C42F (bank 7)
The wait for the frame: waits on the byte at $001A, times entered 34, turns 20,860, writes of it under the frame interrupt 1,976, frames in all 2,302
$C442 (bank 7)
The wait for the frame: waits on the byte at $001A, times entered 114, turns 410,730, writes of it under the frame interrupt 1,976, frames in all 2,302

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
$802A (bank 0)289$001F
$C141 (bank 7)93$001E
$EA1C (bank 7)53
$EAE4 (bank 7)21

The memory its routines share

926 bytes of memory were written by one routine and read by another, and 60 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
$03002553
$00002242
$05001931
$05091931
$02601602
$007A1011
$0405813
$040F812
$0400811
$0401811
$0404811
$0409811

The 24 busiest shared bytes

bytereads and writesroutines writingroutines reading
$001A4,469,53036
$0001766,02566
$0000676,13566
$064D534,00346
$00E4117,69923
$00E5117,69923
$00E259,24966
$00E359,22566
$00E039,85666
$00E139,85666
$000237,87766
$000336,59266
$001423,51014
$002E19,75622
$002F17,96422
$065C15,10236
$002A14,16412
$00EB11,37823
$001D11,05236
$00189,83713
$69979,25634
$00128,94716
$001F8,57266
$00157,80012

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

All the games