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 poll: 2
- The wait for the frame: 3
- The jump engine: 1
- The bank switch: 13
- The picture writer: 1
- The palette writers: 2
- The sprite writers: 30
- The scroll writer: 1
- The sound driver: 1
- The random byte: 1
- Where two things are compared: 5
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.
| at | entered by | times | what it is, and the evidence |
|---|---|---|---|
| $FF12 (bank 30) | a call | 102,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 call | 49,366 | The jump engine: tables 26, jumps through them 49,366 |
| $FC6F (bank 30) | a call | 39,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 call | 26,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 call | 26,084 | The palette writers: frames it ran in 25,697, writes 23,877 |
| $D984 (bank 30) | a call | 25,611 | The random byte: frames it ran in 25,611, bytes $0781,$0782,$0783,$0784, rotates 4, exclusive-ors 1 |
| $FFC2 (bank 30) | a call | 25,352 | The bank switch: writes 50,704, in the blank 1,146, while drawing 49,558 |
| $92DC (bank 26) | a call | 16,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 call | 14,760 | The sprite writers: frames it ran in 1,845, writes to the sprite page 117,916 |
| $FD84 (bank 30) | a call | 11,566 | The sprite writers: frames it ran in 11,523, writes to the sprite page 1,479,690 |
| $83C3 (bank 10) | a call | 8,066 | The sprite writers: frames it ran in 8,066, writes to the sprite page 132 |
| $920B (bank 24) | a call | 6,882 | The sprite writers: frames it ran in 3,442, writes to the sprite page 207,985 |
| $841A (bank 9) | a call | 5,884 | The sprite writers: frames it ran in 2,942, writes to the sprite page 2,832 |
| $9754 (bank 24) | a call | 5,697 | The sprite writers: frames it ran in 1,863, writes to the sprite page 6,804 |
| $89D3 (bank 9) | a call | 5,488 | The sprite writers: frames it ran in 2,744, writes to the sprite page 43,886 |
| $8F44 (bank 24) | a call | 5,390 | The sprite writers: frames it ran in 5,390, writes to the sprite page 344,960 |
| $852B (bank 10) | a call | 5,380 | The sprite writers: frames it ran in 5,380, writes to the sprite page 53,757 |
| $936E (bank 24) | a call | 4,084 | The sprite writers: frames it ran in 2,042, writes to the sprite page 342 |
| $95E2 (bank 9) | a call | 2,942 | The sprite writers: frames it ran in 2,942, writes to the sprite page 23,522 |
| $FFD1 (bank 30) | a call | 2,897 | The bank switch: writes 5,794, in the blank 556, while drawing 5,238 |
| $95BE (bank 11) | a table | 2,178 | The sprite writers: frames it ran in 1,089, writes to the sprite page 20,346 |
| $DBD5 (bank 30) | a call | 2,048 | The bank switch: writes 4,096, in the blank 556, while drawing 3,540 |
| $8C35 (bank 24) | a table | 1,912 | The sprite writers: frames it ran in 4,209, writes to the sprite page 9,945 |
| $97D6 (bank 24) | a call | 1,899 | The sprite writers: frames it ran in 1,863, writes to the sprite page 45,576 |
| $9820 (bank 11) | a table | 1,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 table | 1,599 | The sprite writers: frames it ran in 1,599, writes to the sprite page 902 |
| $8859 (bank 24) | a call | 1,481 | The palette writers: frames it ran in 109, writes 3,488 |
| $96EE (bank 24) | a call | 1,320 | The sprite writers: frames it ran in 586, writes to the sprite page 12,992 |
| $8DCA (bank 10) | a table | 712 | 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 table | 669 | The sprite writers: frames it ran in 669, writes to the sprite page 6,504 |
| $950C (bank 24) | a table | 640 | 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 call | 473 | The bank switch: writes 946, in the blank 0, while drawing 946 |
| $958C (bank 24) | a table | 350 | The sprite writers: frames it ran in 350, writes to the sprite page 4,200 |
| $8F29 (bank 10) | a call | 289 | The sprite writers: frames it ran in 289, writes to the sprite page 6,357 |
| $9568 (bank 24) | a table | 222 | The sprite writers: frames it ran in 222, writes to the sprite page 2,224 |
| $8B84 (bank 10) | a table | 215 | The sprite writers: frames it ran in 43, writes to the sprite page 28,380 |
| $FFBF (bank 30) | a call | 205 | The bank switch: writes 410, in the blank 0, while drawing 410 |
| $9117 (bank 9) | a call | 181 | The sprite writers: frames it ran in 181, writes to the sprite page 1,448 |
| $97BE (bank 9) | a call | 125 | The sprite writers: frames it ran in 125, writes to the sprite page 999 |
| $D6CE (bank 30) | a call | 120 | The sprite writers: frames it ran in 300, writes to the sprite page 30,720 |
| $D4BB (bank 30) | a call | 107 | The bank switch: writes 214, in the blank 0, while drawing 214 |
| $8AA2 (bank 10) | a table | 86 | The sprite writers: frames it ran in 43, writes to the sprite page 11,352 |
| $99F4 (bank 11) | a call | 82 | 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 call | 64 | The bank switch: writes 128, in the blank 0, while drawing 128 |
| $FF40 (bank 30) | power-on | 60 | 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 call | 43 | The sprite writers: frames it ran in 43, writes to the sprite page 5,676 |
| $87A0 (bank 10) | a table | 41 | The sprite writers: frames it ran in 41, writes to the sprite page 902 |
| $F4F0 (bank 30) | a call | 6 | The bank switch: writes 60, in the blank 38, while drawing 22 |
| $99D4 (bank 11) | a call | 44,280 | |
| $8D1B (bank 9) | a call | 35,304 | |
| $98D0 (bank 9) | a call | 35,304 | |
| $8996 (bank 9) | a call | 34,014 | |
| $998B (bank 11) | a call | 29,520 | |
| $8000 (bank 28) | a call | 26,784 | |
| $8661 (bank 28) | a call | 26,607 | |
| $80A1 (bank 28) | a call | 26,578 | |
| $82AB (bank 28) | a call | 26,578 | |
| $8449 (bank 28) | a call | 26,578 | |
| $E34F (bank 30) | a call | 26,567 | |
| $FEBE (bank 30) | a call | 25,611 | |
| $E785 (bank 30) | a call | 21,354 | |
| $D734 (bank 30) | a call | 17,424 | |
| $9071 (bank 24) | a call | 16,409 | |
| $D705 (bank 30) | a call | 16,032 | |
| $98F3 (bank 11) | a call | 14,760 | |
| $D6E5 (bank 30) | a call | 13,590 | |
| $8806 (bank 24) | a call | 13,205 | |
| $93E6 (bank 26) | a call | 12,406 | |
| $E2C0 (bank 30) | a call | 11,838 | |
| $8B30 (bank 9) | a call | 11,808 | |
| $989C (bank 9) | a call | 11,328 | |
| $8B4D (bank 9) | a call | 8,866 | |
| $9C29 (bank 11) | a call | 8,398 | |
| $84E0 (bank 10) | a call | 8,355 | |
| $89B4 (bank 24) | a call | 7,743 | |
| $84FA (bank 10) | a table | 7,307 | |
| $90C1 (bank 24) | a call | 6,956 | |
| $80A7 (bank 9) | a call | 5,884 | |
| $87D2 (bank 9) | a call | 5,669 | |
| $84A8 (bank 9) | a table | 5,488 | |
| $9890 (bank 9) | a call | 5,488 | |
| $8506 (bank 10) | a table | 5,380 | |
| $976E (bank 24) | a call | 5,040 | |
| $8A7D (bank 24) | a call | 4,825 | |
| $8F6D (bank 24) | a call | 4,084 | |
| $8FF8 (bank 24) | a call | 4,084 | |
| $90A0 (bank 24) | a call | 4,084 | |
| $9340 (bank 24) | a call | 4,084 | |
| $89CF (bank 24) | a table | 3,648 | |
| $8EC5 (bank 24) | a call | 3,478 | |
| $93C3 (bank 24) | a call | 3,478 | |
| $90AC (bank 24) | a call | 3,201 | |
| $9421 (bank 24) | a call | 3,201 | |
| $9776 (bank 24) | a call | 3,201 | |
| $81A7 (bank 9) | a call | 2,963 | |
| $8018 (bank 9) | a call | 2,942 | |
| $8026 (bank 9) | a call | 2,942 | |
| $809C (bank 9) | a call | 2,942 | |
| $8106 (bank 9) | a call | 2,942 | |
| $82C1 (bank 9) | a table | 2,942 | |
| $82E5 (bank 9) | a table | 2,942 | |
| $83F1 (bank 9) | a call | 2,942 | |
| $8A4E (bank 9) | a call | 2,942 | |
| $8B94 (bank 9) | a call | 2,942 | |
| $8CF6 (bank 9) | a call | 2,942 | |
| $9789 (bank 9) | a call | 2,942 | |
| $9691 (bank 24) | a call | 2,615 | |
| $8DF5 (bank 11) | a call | 2,178 | |
| $958D (bank 11) | a call | 2,178 | |
| $9A8A (bank 11) | a call | 2,178 | |
| $DC78 (bank 30) | a call | 2,048 | |
| $8AB2 (bank 24) | a table | 2,042 | |
| $8B81 (bank 24) | a call | 2,042 | |
| $978E (bank 24) | a call | 1,912 | |
| $96AD (bank 24) | a call | 1,899 | |
| $E33B (bank 30) | a call | 1,831 | |
| $976C (bank 11) | a call | 1,599 | |
| $E756 (bank 30) | a call | 1,331 | |
| $8B9A (bank 24) | a table | 1,303 | |
| $8CD1 (bank 26) | a call | 1,157 | |
| $8D68 (bank 26) | a call | 1,157 | |
| $8DBD (bank 11) | a call | 1,089 | |
| $8DF4 (bank 11) | a table | 1,089 | |
| $8E7C (bank 11) | a table | 1,089 | |
| $953B (bank 11) | a call | 1,089 | |
| $9B6D (bank 11) | a call | 1,089 | |
| $E7AB (bank 30) | a call | 1,038 | |
| $8BDC (bank 26) | a call | 1,024 | |
| $E7BF (bank 30) | a call | 989 | |
| $E835 (bank 30) | a call | 917 | |
| $903C (bank 26) | a call | 810 | |
| $9073 (bank 26) | a call | 803 | |
| $9175 (bank 26) | a call | 803 | |
| $8F9D (bank 26) | a call | 802 | |
| $9256 (bank 26) | a call | 802 | |
| $944A (bank 26) | a call | 802 | |
| $E831 (bank 30) | a call | 785 | |
| $91FE (bank 10) | a call | 684 | |
| $9280 (bank 10) | a call | 682 | |
| $945A (bank 24) | a table | 586 | |
| $9556 (bank 24) | a table | 572 | |
| $FDC7 (bank 30) | a call | 454 | |
| $9444 (bank 24) | a table | 442 | |
| $9265 (bank 9) | a call | 368 | |
| $854A (bank 10) | a table | 328 | |
| $8566 (bank 10) | a call | 328 | |
| $8D76 (bank 26) | a table | 308 | |
| $8A8C (bank 10) | a call | 301 | |
| $9431 (bank 24) | a table | 292 | |
| $8070 (bank 26) | a call | 289 | |
| $8DBB (bank 26) | a table | 287 | |
| $E7B2 (bank 30) | a call | 287 | |
| $8DA6 (bank 26) | a table | 281 | |
| $8DD6 (bank 26) | a table | 281 | |
| $81AC (bank 28) | a call | 272 | |
| $D935 (bank 30) | a call | 252 | |
| $FDBF (bank 30) | a call | 227 | |
| $8B9B (bank 24) | a table | 216 | |
| $8BAD (bank 24) | a table | 210 | |
| $FDA9 (bank 30) | a call | 206 | |
| $840E (bank 26) | a table | 188 | |
| $89B5 (bank 9) | a call | 181 | |
| $8D3B (bank 9) | a table | 181 | |
| $9035 (bank 9) | a call | 181 | |
| $924D (bank 9) | a call | 181 | |
| $934F (bank 9) | a call | 181 | |
| $8F04 (bank 9) | a call | 162 | |
| $8F7F (bank 9) | a call | 162 | |
| $8FB9 (bank 9) | a table | 162 | |
| $9027 (bank 9) | a call | 162 | |
| $987E (bank 9) | a call | 162 | |
| $9884 (bank 9) | a call | 162 | |
| $8BF7 (bank 24) | a table | 152 | |
| $842C (bank 14) | a table | 147 | |
| $8576 (bank 14) | a table | 147 | |
| $DA49 (bank 30) | a call | 147 | |
| $FD97 (bank 30) | a call | 146 | |
| $FCD8 (bank 30) | a call | 129 | |
| $9878 (bank 9) | a call | 125 | |
| $8489 (bank 14) | a table | 105 | |
| $DA75 (bank 30) | a call | 105 | |
| $D68E (bank 30) | a call | 86 | |
| $8BC0 (bank 24) | a table | 75 | |
| $8BCA (bank 24) | a table | 74 | |
| $8BA3 (bank 26) | a call | 64 | |
| $8C69 (bank 26) | a call | 64 | |
| $983F (bank 27) | a call | 64 | |
| $D51B (bank 30) | a call | 64 | |
| $82C4 (bank 26) | a table | 60 | |
| $8399 (bank 26) | a call | 60 | |
| $88AF (bank 24) | a call | 60 | |
| $8990 (bank 24) | a call | 60 | |
| $90C4 (bank 26) | a call | 51 | |
| $9108 (bank 26) | a call | 51 | |
| $97A8 (bank 24) | a call | 50 | |
| $8AF4 (bank 24) | a table | 49 | |
| $8C1A (bank 24) | a table | 49 | |
| $8B26 (bank 24) | a call | 47 | |
| $E82B (bank 30) | a call | 47 | |
| $8398 (bank 26) | a table | 44 | |
| $81D8 (bank 11) | a call | 43 | |
| $8299 (bank 11) | a call | 43 | |
| $82C4 (bank 10) | a call | 43 | |
| $834D (bank 10) | a call | 43 | |
| $840E (bank 12) | a call | 43 | |
| $845D (bank 12) | a call | 43 | |
| $8CBB (bank 24) | a table | 43 | |
| $FCBF (bank 30) | a call | 43 | |
| $8459 (bank 9) | a table | 42 | |
| $85AB (bank 14) | a table | 42 | |
| $85B8 (bank 14) | a table | 42 | |
| $9792 (bank 11) | a table | 41 | |
| $9327 (bank 9) | a call | 40 | |
| $80CF (bank 26) | a table | 28 | |
| $E7B9 (bank 30) | a call | 28 | |
| $D553 (bank 30) | a call | 27 | |
| $8B5E (bank 24) | a call | 24 | |
| $93E8 (bank 24) | a call | 24 | |
| $8200 (bank 9) | a table | 21 | |
| $823C (bank 9) | a table | 21 | |
| $8408 (bank 14) | a table | 21 | |
| $85F2 (bank 14) | a table | 21 | |
| $DA1D (bank 30) | a call | 21 | |
| $FDB1 (bank 30) | a call | 21 | |
| $8328 (bank 26) | a call | 16 | |
| $9409 (bank 24) | a table | 16 | |
| $8BE4 (bank 24) | a table | 12 | |
| $9818 (bank 9) | a call | 10 | |
| $83B1 (bank 26) | a table | 8 | |
| $83CD (bank 26) | a table | 8 | |
| $8118 (bank 26) | a table | 7 | |
| $8092 (bank 26) | a table | 6 | |
| $9805 (bank 9) | a call | 5 | |
| $9369 (bank 10) | a call | 4 | |
| $940A (bank 24) | a table | 4 | |
| $941B (bank 24) | a table | 4 | |
| $8C1A (bank 9) | a call | 3 | |
| $8C8C (bank 9) | a table | 3 | |
| $8383 (bank 9) | a call | 1 | |
| $8522 (bank 26) | a call | 1 |
Where it waits
Loops a rule named that sit inside a routine and are not themselves a place the code is entered.
| at | what 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
| from | bytes reached | instructions | positions it holds |
|---|---|---|---|
| $0075 | 129 | 9 | 2 down |
| $00A5 | 16 | 2 | 1 across, 1 down |
| $0087 | 6 | 9 | 2 across |
| $0079 | 2 | 4 | 2 across |
| $0722 | 2 | 1 | 1 across |
| $0201 | 253 | 15 | |
| $0200 | 253 | 14 | |
| $0203 | 253 | 10 | |
| $0000 | 246 | 3 | |
| $0202 | 153 | 10 | |
| $0205 | 153 | 9 | |
| $0204 | 153 | 6 |
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.
| slots | arrays | routines | positions across | positions down | added into them | choosing a jump | travelling with them |
|---|---|---|---|---|---|---|---|
| 129 | 6 | 10 | $0079 | $0075 | $0077, $0085, $0095, $00B7 | ||
| 6 | 8 | 12 | $0087 | $0097 | $00D8 | $0077, $008F, $0097, $009F, $00D2, $00D8, $051F |
The 24 busiest shared bytes
| byte | reads and writes | routines writing | routines reading |
|---|---|---|---|
| $0000 | 5,090,237 | 6 | 6 |
| $0001 | 4,530,158 | 6 | 6 |
| $0002 | 1,217,176 | 6 | 6 |
| $0003 | 623,395 | 6 | 6 |
| $000E | 361,054 | 6 | 6 |
| $000F | 264,250 | 6 | 6 |
| $000C | 220,220 | 6 | 6 |
| $0005 | 143,473 | 6 | 5 |
| $0025 | 140,069 | 4 | 4 |
| $0006 | 130,173 | 6 | 6 |
| $0007 | 110,525 | 6 | 6 |
| $04F4 | 106,478 | 2 | 2 |
| $0782 | 106,148 | 2 | 4 |
| $00BC | 102,091 | 6 | 6 |
| $0720 | 95,849 | 6 | 6 |
| $0785 | 84,926 | 2 | 3 |
| $0786 | 84,925 | 2 | 3 |
| $0788 | 84,924 | 2 | 3 |
| $0784 | 84,903 | 2 | 3 |
| $0787 | 84,838 | 2 | 3 |
| $0789 | 84,835 | 2 | 3 |
| $0783 | 84,759 | 2 | 3 |
| $0721 | 84,744 | 6 | 4 |
| $0015 | 84,087 | 4 | 6 |
This page shows none of the game's bytes. The listing these figures were read from stays with the cartridge.