Super Mario Bros. 3 (USA) (Rev 1)

Super Mario Bros. 3 (USA) (Rev 1) is on a MMC3 board with 262,144 bytes of program. A crawl of 400 steps from power-on kept 60 paths that found new code. Played back over 38,720 frames, they executed 19,069 bytes of it, 7 percent.

What the rules named

The 242 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
$FF12 (bank 30)a call102,750
The poll: port $4016, reads a frame 16, strobes a frame 8
The poll: port $4017, reads a frame 16, strobes a frame 8
$FE99 (bank 30)a call49,366
The jump engine: tables 26, jumps through them 49,366
$FC6F (bank 30)a call39,143
The bank switch: writes 156,471, in the blank 54,153, while drawing 102,318
$F486 (bank 30)each frame (NMI)26,795
The bank switch: writes 267,740, in the blank 234,470, while drawing 33,270
The scroll writer: frames it ran in 26,838, writes in the blank 55,942
$FFAD (bank 30)a call26,795
The bank switch: writes 321,511, in the blank 321,511, while drawing 0
$F795 (bank 30)an interrupt (IRQ)26,622
The bank switch: writes 199,281, in the blank 0, while drawing 199,281
The sound driver: frames it ran in 26,622, writes 53,241
$9293 (bank 26)a call26,084
The palette writers: frames it ran in 25,697, writes 23,877
$D984 (bank 30)a call25,611
The random byte: frames it ran in 25,611, bytes $0781,$0782,$0783,$0784, rotates 4, exclusive-ors 1
$FFC2 (bank 30)a call25,352
The bank switch: writes 50,704, in the blank 1,146, while drawing 49,558
$92DC (bank 26)a call16,502
The picture writer: frames it ran in 12,897, writes 139,264, in the blank 17,632, while drawing 121,632
$99AA (bank 11)a call14,760
The sprite writers: frames it ran in 1,845, writes to the sprite page 117,916
$FD84 (bank 30)a call11,566
The sprite writers: frames it ran in 11,523, writes to the sprite page 1,479,690
$83C3 (bank 10)a call8,066
The sprite writers: frames it ran in 8,066, writes to the sprite page 132
$920B (bank 24)a call6,882
The sprite writers: frames it ran in 3,442, writes to the sprite page 207,985
$841A (bank 9)a call5,884
The sprite writers: frames it ran in 2,942, writes to the sprite page 2,832
$9754 (bank 24)a call5,697
The sprite writers: frames it ran in 1,863, writes to the sprite page 6,804
$89D3 (bank 9)a call5,488
The sprite writers: frames it ran in 2,744, writes to the sprite page 43,886
$8F44 (bank 24)a call5,390
The sprite writers: frames it ran in 5,390, writes to the sprite page 344,960
$852B (bank 10)a call5,380
The sprite writers: frames it ran in 5,380, writes to the sprite page 53,757
$936E (bank 24)a call4,084
The sprite writers: frames it ran in 2,042, writes to the sprite page 342
$95E2 (bank 9)a call2,942
The sprite writers: frames it ran in 2,942, writes to the sprite page 23,522
$FFD1 (bank 30)a call2,897
The bank switch: writes 5,794, in the blank 556, while drawing 5,238
$95BE (bank 11)a table2,178
The sprite writers: frames it ran in 1,089, writes to the sprite page 20,346
$DBD5 (bank 30)a call2,048
The bank switch: writes 4,096, in the blank 556, while drawing 3,540
$8C35 (bank 24)a table1,912
The sprite writers: frames it ran in 4,209, writes to the sprite page 9,945
$97D6 (bank 24)a call1,899
The sprite writers: frames it ran in 1,863, writes to the sprite page 45,576
$9820 (bank 11)a table1,886
Where two things are compared: instructions 2, pairs of bytes 3, bytes in all 5, times compared 2,829, X positions at $0079,$00B1,$0722, Y positions at $0075,$00B2
$86C4 (bank 10)a table1,599
The sprite writers: frames it ran in 1,599, writes to the sprite page 902
$8859 (bank 24)a call1,481
The palette writers: frames it ran in 109, writes 3,488
$96EE (bank 24)a call1,320
The sprite writers: frames it ran in 586, writes to the sprite page 12,992
$8DCA (bank 10)a table712
Where two things are compared: instructions 2, pairs of bytes 2, bytes in all 4, times compared 54, X positions at $0079,$007A, Y positions at $0075,$0076
The sprite writers: frames it ran in 712, writes to the sprite page 15,644
$94C0 (bank 24)a table669
The sprite writers: frames it ran in 669, writes to the sprite page 6,504
$950C (bank 24)a table640
Where two things are compared: instructions 1, pairs of bytes 1, bytes in all 2, times compared 640, X positions at $008B,$008C
The sprite writers: frames it ran in 640, writes to the sprite page 6,400
$D4CD (bank 30)a call473
The bank switch: writes 946, in the blank 0, while drawing 946
$958C (bank 24)a table350
The sprite writers: frames it ran in 350, writes to the sprite page 4,200
$8F29 (bank 10)a call289
The sprite writers: frames it ran in 289, writes to the sprite page 6,357
$9568 (bank 24)a table222
The sprite writers: frames it ran in 222, writes to the sprite page 2,224
$8B84 (bank 10)a table215
The sprite writers: frames it ran in 43, writes to the sprite page 28,380
$FFBF (bank 30)a call205
The bank switch: writes 410, in the blank 0, while drawing 410
$9117 (bank 9)a call181
The sprite writers: frames it ran in 181, writes to the sprite page 1,448
$97BE (bank 9)a call125
The sprite writers: frames it ran in 125, writes to the sprite page 999
$D6CE (bank 30)a call120
The sprite writers: frames it ran in 300, writes to the sprite page 30,720
$D4BB (bank 30)a call107
The bank switch: writes 214, in the blank 0, while drawing 214
$8AA2 (bank 10)a table86
The sprite writers: frames it ran in 43, writes to the sprite page 11,352
$99F4 (bank 11)a call82
Where two things are compared: instructions 2, pairs of bytes 3, bytes in all 5, times compared 246, X positions at $0079,$00B1,$0722, Y positions at $0075,$00B2
$DABA (bank 30)a call64
The bank switch: writes 128, in the blank 0, while drawing 128
$FF40 (bank 30)power-on60
The bank switch: writes 429, in the blank 300, while drawing 129
Where two things are compared: instructions 1, pairs of bytes 1, bytes in all 2, times compared 5,428, X positions at $00B1,$0722
The sprite writers: frames it ran in 13,422, writes to the sprite page 1,585
$91AC (bank 10)a call43
The sprite writers: frames it ran in 43, writes to the sprite page 5,676
$87A0 (bank 10)a table41
The sprite writers: frames it ran in 41, writes to the sprite page 902
$F4F0 (bank 30)a call6
The bank switch: writes 60, in the blank 38, while drawing 22
$99D4 (bank 11)a call44,280
$8D1B (bank 9)a call35,304
$98D0 (bank 9)a call35,304
$8996 (bank 9)a call34,014
$998B (bank 11)a call29,520
$8000 (bank 28)a call26,784
$8661 (bank 28)a call26,607
$80A1 (bank 28)a call26,578
$82AB (bank 28)a call26,578
$8449 (bank 28)a call26,578
$E34F (bank 30)a call26,567
$FEBE (bank 30)a call25,611
$E785 (bank 30)a call21,354
$D734 (bank 30)a call17,424
$9071 (bank 24)a call16,409
$D705 (bank 30)a call16,032
$98F3 (bank 11)a call14,760
$D6E5 (bank 30)a call13,590
$8806 (bank 24)a call13,205
$93E6 (bank 26)a call12,406
$E2C0 (bank 30)a call11,838
$8B30 (bank 9)a call11,808
$989C (bank 9)a call11,328
$8B4D (bank 9)a call8,866
$9C29 (bank 11)a call8,398
$84E0 (bank 10)a call8,355
$89B4 (bank 24)a call7,743
$84FA (bank 10)a table7,307
$90C1 (bank 24)a call6,956
$80A7 (bank 9)a call5,884
$87D2 (bank 9)a call5,669
$84A8 (bank 9)a table5,488
$9890 (bank 9)a call5,488
$8506 (bank 10)a table5,380
$976E (bank 24)a call5,040
$8A7D (bank 24)a call4,825
$8F6D (bank 24)a call4,084
$8FF8 (bank 24)a call4,084
$90A0 (bank 24)a call4,084
$9340 (bank 24)a call4,084
$89CF (bank 24)a table3,648
$8EC5 (bank 24)a call3,478
$93C3 (bank 24)a call3,478
$90AC (bank 24)a call3,201
$9421 (bank 24)a call3,201
$9776 (bank 24)a call3,201
$81A7 (bank 9)a call2,963
$8018 (bank 9)a call2,942
$8026 (bank 9)a call2,942
$809C (bank 9)a call2,942
$8106 (bank 9)a call2,942
$82C1 (bank 9)a table2,942
$82E5 (bank 9)a table2,942
$83F1 (bank 9)a call2,942
$8A4E (bank 9)a call2,942
$8B94 (bank 9)a call2,942
$8CF6 (bank 9)a call2,942
$9789 (bank 9)a call2,942
$9691 (bank 24)a call2,615
$8DF5 (bank 11)a call2,178
$958D (bank 11)a call2,178
$9A8A (bank 11)a call2,178
$DC78 (bank 30)a call2,048
$8AB2 (bank 24)a table2,042
$8B81 (bank 24)a call2,042
$978E (bank 24)a call1,912
$96AD (bank 24)a call1,899
$E33B (bank 30)a call1,831
$976C (bank 11)a call1,599
$E756 (bank 30)a call1,331
$8B9A (bank 24)a table1,303
$8CD1 (bank 26)a call1,157
$8D68 (bank 26)a call1,157
$8DBD (bank 11)a call1,089
$8DF4 (bank 11)a table1,089
$8E7C (bank 11)a table1,089
$953B (bank 11)a call1,089
$9B6D (bank 11)a call1,089
$E7AB (bank 30)a call1,038
$8BDC (bank 26)a call1,024
$E7BF (bank 30)a call989
$E835 (bank 30)a call917
$903C (bank 26)a call810
$9073 (bank 26)a call803
$9175 (bank 26)a call803
$8F9D (bank 26)a call802
$9256 (bank 26)a call802
$944A (bank 26)a call802
$E831 (bank 30)a call785
$91FE (bank 10)a call684
$9280 (bank 10)a call682
$945A (bank 24)a table586
$9556 (bank 24)a table572
$FDC7 (bank 30)a call454
$9444 (bank 24)a table442
$9265 (bank 9)a call368
$854A (bank 10)a table328
$8566 (bank 10)a call328
$8D76 (bank 26)a table308
$8A8C (bank 10)a call301
$9431 (bank 24)a table292
$8070 (bank 26)a call289
$8DBB (bank 26)a table287
$E7B2 (bank 30)a call287
$8DA6 (bank 26)a table281
$8DD6 (bank 26)a table281
$81AC (bank 28)a call272
$D935 (bank 30)a call252
$FDBF (bank 30)a call227
$8B9B (bank 24)a table216
$8BAD (bank 24)a table210
$FDA9 (bank 30)a call206
$840E (bank 26)a table188
$89B5 (bank 9)a call181
$8D3B (bank 9)a table181
$9035 (bank 9)a call181
$924D (bank 9)a call181
$934F (bank 9)a call181
$8F04 (bank 9)a call162
$8F7F (bank 9)a call162
$8FB9 (bank 9)a table162
$9027 (bank 9)a call162
$987E (bank 9)a call162
$9884 (bank 9)a call162
$8BF7 (bank 24)a table152
$842C (bank 14)a table147
$8576 (bank 14)a table147
$DA49 (bank 30)a call147
$FD97 (bank 30)a call146
$FCD8 (bank 30)a call129
$9878 (bank 9)a call125
$8489 (bank 14)a table105
$DA75 (bank 30)a call105
$D68E (bank 30)a call86
$8BC0 (bank 24)a table75
$8BCA (bank 24)a table74
$8BA3 (bank 26)a call64
$8C69 (bank 26)a call64
$983F (bank 27)a call64
$D51B (bank 30)a call64
$82C4 (bank 26)a table60
$8399 (bank 26)a call60
$88AF (bank 24)a call60
$8990 (bank 24)a call60
$90C4 (bank 26)a call51
$9108 (bank 26)a call51
$97A8 (bank 24)a call50
$8AF4 (bank 24)a table49
$8C1A (bank 24)a table49
$8B26 (bank 24)a call47
$E82B (bank 30)a call47
$8398 (bank 26)a table44
$81D8 (bank 11)a call43
$8299 (bank 11)a call43
$82C4 (bank 10)a call43
$834D (bank 10)a call43
$840E (bank 12)a call43
$845D (bank 12)a call43
$8CBB (bank 24)a table43
$FCBF (bank 30)a call43
$8459 (bank 9)a table42
$85AB (bank 14)a table42
$85B8 (bank 14)a table42
$9792 (bank 11)a table41
$9327 (bank 9)a call40
$80CF (bank 26)a table28
$E7B9 (bank 30)a call28
$D553 (bank 30)a call27
$8B5E (bank 24)a call24
$93E8 (bank 24)a call24
$8200 (bank 9)a table21
$823C (bank 9)a table21
$8408 (bank 14)a table21
$85F2 (bank 14)a table21
$DA1D (bank 30)a call21
$FDB1 (bank 30)a call21
$8328 (bank 26)a call16
$9409 (bank 24)a table16
$8BE4 (bank 24)a table12
$9818 (bank 9)a call10
$83B1 (bank 26)a table8
$83CD (bank 26)a table8
$8118 (bank 26)a table7
$8092 (bank 26)a table6
$9805 (bank 9)a call5
$9369 (bank 10)a call4
$940A (bank 24)a table4
$941B (bank 24)a table4
$8C1A (bank 9)a call3
$8C8C (bank 9)a table3
$8383 (bank 9)a call1
$8522 (bank 26)a call1

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
$881C (bank 24)
The wait for the frame: waits on the byte at $0010, times entered 13,199, turns 56,343,449, writes of it under the frame interrupt 53,478, frames in all 28,220
$804B (bank 28)
The wait for the frame: waits on the byte at $04E0, times entered 3, turns 3, writes of it under the frame interrupt 859, frames in all 28,220
$D6FB (bank 30)
The wait for the frame: waits on the byte at $0010, times entered 13,579, turns 49,905,908, writes of it under the frame interrupt 53,478, frames in all 28,220

The memory its routines share

979 bytes of memory were written by one routine and read by another, and 139 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
$007512992 down
$00A51621 across, 1 down
$0087692 across
$0079242 across
$0722211 across
$020125315
$020025314
$020325310
$00002463
$020215310
$02051539
$02041536

What travels with a position

Arrays that at least two routines step through together with an array of positions, across the same range. That is what a table of the things on the screen looks like in memory: one array for each property, one slot for each thing. We can say which arrays hold positions, which of the others get added into them, which is what a speed does, and which pick the way through a jump table, which is what a state or a kind does. What the rest hold is not named yet.

slotsarraysroutinespositions acrosspositions downadded into themchoosing a jumptravelling with them
129610$0079$0075$0077, $0085, $0095, $00B7
6812$0087$0097$00D8$0077, $008F, $0097, $009F, $00D2, $00D8, $051F

The 24 busiest shared bytes

bytereads and writesroutines writingroutines reading
$00005,090,23766
$00014,530,15866
$00021,217,17666
$0003623,39566
$000E361,05466
$000F264,25066
$000C220,22066
$0005143,47365
$0025140,06944
$0006130,17366
$0007110,52566
$04F4106,47822
$0782106,14824
$00BC102,09166
$072095,84966
$078584,92623
$078684,92523
$078884,92423
$078484,90323
$078784,83823
$078984,83523
$078384,75923
$072184,74464
$001584,08746

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

All the games