Super Mario Bros. + Duck Hunt (USA)
Super Mario Bros. + Duck Hunt (USA) is on a GxROM board with 65,536 bytes of program. A crawl of 400 steps from power-on kept 39 paths that found new code. Played back over 20,979 frames, they executed 11,910 bytes of it, 18 percent.
What the rules named
- The poll: 4
- The idle spin: 1
- The game inside the interrupt: 1
- The wait for the frame: 3
- The jump engine: 2
- The bank switch: 1
- The picture writer: 1
- The palette writers: 3
- The sprite writers: 24
- The scroll writer: 1
- The split: 2
- The sound driver: 1
- The random byte: 1
- Where two things are compared: 1
The 247 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 |
|---|---|---|---|
| $C588 (bank 1) | a call | 1,957,668 | The random byte: frames it ran in 7,842, bytes $05EC,$05ED,$05EE,$05EF, rotates 4, exclusive-ors 1 |
| $D10E (bank 1) | a call | 152,286 | Where two things are compared: instructions 1, pairs of bytes 1, bytes in all 2, times compared 57, X positions at $0032,$0033, Y positions at $0032,$0033 |
| $C35E (bank 1) | a call | 16,167 | The jump engine: tables 5, jumps through them 16,167 |
| $C086 (bank 1) | each frame (NMI) | 9,359 | The game inside the interrupt: frames it ran in 9,359, frames in all 10,479, the spin is at $8057 |
| $C3C1 (bank 1) | a call | 7,994 | The scroll writer: frames it ran in 7,974, writes in the blank 15,948 |
| $C2BF (bank 1) | a call | 7,974 | The picture writer: frames it ran in 7,974, writes 6,923, in the blank 6,923, while drawing 0 |
| $C291 (bank 1) | a call | 7,776 | The poll: port $4016, reads a frame 8, strobes a frame 0 |
| $F56C (bank 1) | a call | 7,776 | The sound driver: frames it ran in 7,776, writes 7,776 |
| $CE4D (bank 1) | a call | 5,482 | The sprite writers: frames it ran in 5,482, writes to the sprite page 1,015,547 |
| $8E04 (bank 0) | a call | 3,435 | The jump engine: tables 8, jumps through them 3,435 |
| $EBB2 (bank 0) | a call | 1,944 | The sprite writers: frames it ran in 486, writes to the sprite page 15,552 |
| $8158 (bank 1) | a call | 1,219 | The poll: port $4016, reads a frame 8, strobes a frame 3 |
| $8082 (bank 0) | each frame (NMI) | 807 | The split: frames it ran in 816, scroll writes while drawing 1,218, status reads while drawing 103,445 |
| $8EDD (bank 0) | a call | 807 | The palette writers: frames it ran in 807, writes 568 |
| $8E5C (bank 0) | a call | 806 | The poll: port $4017, reads a frame 8, strobes a frame 2 |
| $8E6A (bank 0) | a call | 806 | The poll: port $4016, reads a frame 8, strobes a frame 0 |
| $CA19 (bank 1) | a table | 526 | The sprite writers: frames it ran in 526, writes to the sprite page 30,725 |
| $CD5C (bank 1) | a table | 526 | The sprite writers: frames it ran in 526, writes to the sprite page 96,583 |
| $8222 (bank 0) (inside another instruction) | a call | 489 | The sprite writers: frames it ran in 494, writes to the sprite page 30,807 |
| $F0E9 (bank 0) | a call | 483 | The sprite writers: frames it ran in 483, writes to the sprite page 966 |
| $CEF9 (bank 1) | a table | 164 | The sprite writers: frames it ran in 164, writes to the sprite page 26,460 |
| $C23B (bank 1) | a call | 86 | The sprite writers: frames it ran in 86, writes to the sprite page 5,504 |
| $82BC (bank 1) | a call | 78 | The sprite writers: frames it ran in 78, writes to the sprite page 3,744 |
| $C3B8 (bank 1) | a call | 73 | The palette writers: frames it ran in 73, writes 2,176 |
| $CD16 (bank 1) | a table | 47 | The sprite writers: frames it ran in 47, writes to the sprite page 8,977 |
| $C617 (bank 1) | a call | 43 | The split: frames it ran in 86, scroll writes while drawing 86, status reads while drawing 2,366 |
| $8000 (bank 0) | power-on | 39 | The bank switch: writes 39, in the blank 39, while drawing 0 The sprite writers: frames it ran in 10,189, writes to the sprite page 5,888 |
| $80EF (bank 1) | a call | 39 | The sprite writers: frames it ran in 78, writes to the sprite page 9,984 |
| $822C (bank 1) | a call | 39 | The palette writers: frames it ran in 39, writes 1,248 |
| $8268 (bank 1) | a call | 39 | The sprite writers: frames it ran in 39, writes to the sprite page 156 |
| $82B7 (bank 1) | a call | 38 | The sprite writers: frames it ran in 38, writes to the sprite page 1,824 |
| $CD3C (bank 1) | a table | 31 | The sprite writers: frames it ran in 31, writes to the sprite page 5,921 |
| $90CC (bank 0) | a call | 21 | The sprite writers: frames it ran in 42, writes to the sprite page 5,376 |
| $8220 (bank 0) | a call | 16 | The sprite writers: frames it ran in 16, writes to the sprite page 1,024 |
| $CD4C (bank 1) | a table | 13 | The sprite writers: frames it ran in 13, writes to the sprite page 2,483 |
| $CD52 (bank 1) | a table | 12 | The sprite writers: frames it ran in 12, writes to the sprite page 2,292 |
| $CE40 (bank 1) | a table | 10 | The sprite writers: frames it ran in 10, writes to the sprite page 1,910 |
| $CF00 (bank 1) | a table | 10 | The sprite writers: frames it ran in 10, writes to the sprite page 1,910 |
| $9061 (bank 0) | a table | 5 | The sprite writers: frames it ran in 5, writes to the sprite page 20 |
| $82B2 (bank 1) | a call | 4 | The sprite writers: frames it ran in 4, writes to the sprite page 192 |
| $EFA4 (bank 0) | a call | 3 | The sprite writers: frames it ran in 3, writes to the sprite page 3 |
| $D12B (bank 1) | a call | 152,934 | |
| $D114 (bank 1) | a call | 152,286 | |
| $C426 (bank 1) | a call | 15,530 | |
| $C5F7 (bank 1) | a call | 8,211 | |
| $C607 (bank 1) | a call | 8,194 | |
| $C249 (bank 1) | a call | 7,974 | |
| $C263 (bank 1) | a call | 7,974 | |
| $C61E (bank 1) | a call | 7,954 | |
| $C284 (bank 1) | a call | 7,776 | |
| $C348 (bank 1) | a call | 7,776 | |
| $F591 (bank 1) | a call | 7,776 | |
| $F621 (bank 1) | a call | 7,776 | |
| $F6CF (bank 1) | a call | 7,776 | |
| $F7CC (bank 1) | a call | 7,776 | |
| $C0B3 (bank 1) | a call | 7,775 | |
| $D131 (bank 1) | a call | 7,633 | |
| $D160 (bank 1) | a call | 7,633 | |
| $C86E (bank 1) | a table | 7,195 | |
| $CC94 (bank 1) | a call | 7,195 | |
| $C6C4 (bank 1) | a call | 7,178 | |
| $C6F5 (bank 1) | a call | 7,178 | |
| $C7FB (bank 1) | a call | 7,178 | |
| $C890 (bank 1) | a call | 7,178 | |
| $CCA9 (bank 1) | a call | 7,178 | |
| $CFBA (bank 1) | a call | 7,178 | |
| $CFC5 (bank 1) | a call | 7,178 | |
| $D3D2 (bank 1) | a call | 7,178 | |
| $D428 (bank 1) | a call | 7,178 | |
| $D3DF (bank 1) | a call | 7,168 | |
| $CD1D (bank 1) | a table | 3,784 | |
| $9BE1 (bank 0) | a call | 3,445 | |
| $84C3 (bank 0) | a call | 2,898 | |
| $C047 (bank 0) | a call | 2,898 | |
| $F26D (bank 0) | a call | 2,385 | |
| $E3EB (bank 0) (inside another instruction) | a call | 1,892 | |
| $C5E0 (bank 1) | a table | 1,468 | |
| $F1F6 (bank 0) | a call | 1,429 | |
| $8129 (bank 1) | a call | 1,385 | |
| $84F4 (bank 1) | a call | 1,229 | |
| $827C (bank 1) | a call | 1,132 | |
| $8EED (bank 0) | a call | 1,072 | |
| $C902 (bank 1) | a call | 1,016 | |
| $BE70 (bank 0) | a call | 966 | |
| $F12A (bank 0) | a call | 956 | |
| $F171 (bank 0) | a call | 956 | |
| $F180 (bank 0) | a call | 956 | |
| $F1D7 (bank 0) | a call | 956 | |
| $E3E8 (bank 0) | a call | 946 | |
| $F564 (bank 1) | a call | 852 | |
| $C71D (bank 1) | a call | 833 | |
| $8EE6 (bank 0) | a call | 807 | |
| $8182 (bank 0) | a call | 806 | |
| $8F97 (bank 0) | a call | 806 | |
| $8F9E (bank 0) | a call | 806 | |
| $F2D0 (bank 0) | a call | 806 | |
| $8212 (bank 0) | a call | 801 | |
| $F544 (bank 1) | a call | 780 | |
| $F42E (bank 1) | a table | 745 | |
| $F550 (bank 1) | a call | 745 | |
| $F4EE (bank 1) | a table | 708 | |
| $F502 (bank 1) | a call | 708 | |
| $F49B (bank 1) | a table | 647 | |
| $F568 (bank 1) | a call | 647 | |
| $8231 (bank 0) | a table | 630 | |
| $92B0 (bank 0) | a call | 536 | |
| $92C8 (bank 0) | a call | 536 | |
| $D81B (bank 1) | a call | 526 | |
| $81C6 (bank 0) | a call | 489 | |
| $8245 (bank 0) | a table | 486 | |
| $89E1 (bank 0) | a call | 483 | |
| $AEEA (bank 0) | a call | 483 | |
| $B04A (bank 0) | a call | 483 | |
| $B29A (bank 0) | a call | 483 | |
| $B624 (bank 0) | a call | 483 | |
| $B74F (bank 0) | a call | 483 | |
| $B7B8 (bank 0) | a call | 483 | |
| $B855 (bank 0) | a call | 483 | |
| $B9BC (bank 0) | a call | 483 | |
| $BB96 (bank 0) | a call | 483 | |
| $BED4 (bank 0) | a call | 483 | |
| $EEE9 (bank 0) | a call | 483 | |
| $EFBE (bank 0) | a call | 483 | |
| $EFEC (bank 0) | a call | 483 | |
| $F091 (bank 0) | a call | 483 | |
| $C932 (bank 1) | a table | 480 | |
| $AF93 (bank 0) | a call | 473 | |
| $B0E9 (bank 0) | a table | 473 | |
| $B329 (bank 0) | a call | 473 | |
| $B35A (bank 0) | a table | 473 | |
| $B450 (bank 0) | a call | 473 | |
| $B58F (bank 0) | a call | 473 | |
| $B5CC (bank 0) | a call | 473 | |
| $BF09 (bank 0) | a call | 473 | |
| $DC64 (bank 0) | a call | 473 | |
| $DEBD (bank 0) | a call | 473 | |
| $DEC4 (bank 0) | a call | 473 | |
| $DEDD (bank 0) | a call | 473 | |
| $DEE8 (bank 0) | a call | 473 | |
| $DF9A (bank 0) | a call | 473 | |
| $DFA1 (bank 0) | a call | 473 | |
| $DFB0 (bank 0) | a call | 473 | |
| $E29C (bank 0) | a call | 473 | |
| $E3E9 (bank 0) | a call | 473 | |
| $9595 (bank 0) | a call | 402 | |
| $8567 (bank 0) | a table | 301 | |
| $88AE (bank 0) | a table | 268 | |
| $C5D9 (bank 1) | a call | 198 | |
| $F41B (bank 0) | a call | 174 | |
| $F57C (bank 0) | a call | 174 | |
| $F667 (bank 0) | a call | 174 | |
| $F694 (bank 0) | a call | 174 | |
| $AEDC (bank 0) | a table | 171 | |
| $889D (bank 0) | a table | 150 | |
| $92DB (bank 0) | a table | 134 | |
| $93FC (bank 0) | a table | 134 | |
| $9508 (bank 0) | a call | 134 | |
| $CF0B (bank 1) | a call | 123 | |
| $F4E5 (bank 1) | a table | 119 | |
| $811C (bank 1) | a call | 117 | |
| $81C5 (bank 1) | a call | 78 | |
| $8218 (bank 1) | a call | 78 | |
| $86E6 (bank 0) | a table | 67 | |
| $896A (bank 0) | a call | 67 | |
| $D4EE (bank 1) | a call | 65 | |
| $F366 (bank 1) | a call | 65 | |
| $810F (bank 1) | a call | 59 | |
| $8407 (bank 1) | a call | 55 | |
| $CEED (bank 1) | a table | 49 | |
| $F383 (bank 1) | a call | 46 | |
| $F3D0 (bank 1) | a call | 46 | |
| $C22B (bank 1) | a call | 43 | |
| $C232 (bank 1) | a call | 43 | |
| $C5E1 (bank 1) | a call | 43 | |
| $9BBB (bank 0) | a call | 40 | |
| $C64B (bank 1) | a call | 40 | |
| $D4D9 (bank 1) | a call | 40 | |
| $80A9 (bank 1) | a call | 39 | |
| $80EE (bank 1) | a table | 39 | |
| $8478 (bank 1) | a call | 39 | |
| $84A1 (bank 1) | a call | 39 | |
| $84F3 (bank 1) | a table | 39 | |
| $8511 (bank 1) | a call | 39 | |
| $D528 (bank 1) | a call | 32 | |
| $9589 (bank 0) | a call | 25 | |
| $C230 (bank 1) | a call | 23 | |
| $C303 (bank 1) | a call | 23 | |
| $C5AA (bank 1) | a table | 23 | |
| $D4E2 (bank 1) | a call | 23 | |
| $D509 (bank 1) | a call | 23 | |
| $F581 (bank 1) | a call | 23 | |
| $9A2E (bank 0) | a table | 20 | |
| $9B0E (bank 0) | a table | 20 | |
| $9B36 (bank 0) | a call | 20 | |
| $9BAC (bank 0) | a call | 20 | |
| $C4BF (bank 1) | a call | 20 | |
| $C502 (bank 1) | a call | 20 | |
| $C5EE (bank 1) | a call | 20 | |
| $C641 (bank 1) | a call | 20 | |
| $C793 (bank 1) | a call | 20 | |
| $C7B3 (bank 1) | a call | 20 | |
| $C81D (bank 1) | a table | 20 | |
| $C839 (bank 1) | a table | 20 | |
| $C854 (bank 1) | a table | 20 | |
| $CCD4 (bank 1) | a table | 20 | |
| $CF44 (bank 1) | a call | 20 | |
| $D2A4 (bank 1) | a call | 20 | |
| $8E19 (bank 0) | a call | 15 | |
| $8E2D (bank 0) | a call | 15 | |
| $85F1 (bank 0) | a call | 14 | |
| $8F06 (bank 0) | a call | 14 | |
| $8F11 (bank 0) | a call | 14 | |
| $8808 (bank 0) | a call | 12 | |
| $D52C (bank 1) | a call | 12 | |
| $C919 (bank 1) | a table | 10 | |
| $CD9A (bank 1) | a table | 10 | |
| $858B (bank 0) | a table | 9 | |
| $859B (bank 0) | a table | 9 | |
| $8652 (bank 0) | a table | 9 | |
| $865A (bank 0) | a table | 9 | |
| $8693 (bank 0) | a table | 9 | |
| $86A8 (bank 0) | a table | 9 | |
| $9C03 (bank 0) | a call | 9 | |
| $9C09 (bank 0) | a call | 9 | |
| $9C13 (bank 0) | a call | 9 | |
| $9C22 (bank 0) | a call | 9 | |
| $B038 (bank 0) | a call | 9 | |
| $BC30 (bank 0) | a call | 9 | |
| $F423 (bank 1) | a table | 8 | |
| $8325 (bank 0) | a call | 7 | |
| $8FCF (bank 0) | a table | 6 | |
| $85BF (bank 0) | a table | 5 | |
| $85E3 (bank 0) | a table | 5 | |
| $8643 (bank 0) | a table | 5 | |
| $86FF (bank 0) | a table | 5 | |
| $8732 (bank 0) | a table | 5 | |
| $8749 (bank 0) | a table | 5 | |
| $90ED (bank 0) | a call | 5 | |
| $9131 (bank 0) | a table | 5 | |
| $92AA (bank 0) | a call | 5 | |
| $92AF (bank 0) | a call | 5 | |
| $B069 (bank 0) | a table | 5 | |
| $BC36 (bank 0) | a call | 5 | |
| $88A5 (bank 0) | a call | 3 | |
| $8FE4 (bank 0) | a table | 3 | |
| $D464 (bank 1) | a call | 3 | |
| $EFDC (bank 0) | a call | 3 |
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 |
|---|---|
| $8057 (bank 0) | The idle spin: turns 5,174,858, turns a frame 493 |
| $813D (bank 1) | The wait for the frame: waits on the byte at $0020, times entered 1,385, turns 3,486,089, writes of it under the frame interrupt 9,380, frames in all 10,479 |
| $C07C (bank 1) | The wait for the frame: waits on the byte at $0020, times entered 7,779, turns 1,957,629, calls on each turn 1, writes of it under the frame interrupt 9,380, frames in all 10,479 |
| $C5DC (bank 1) | The wait for the frame: waits on the byte at $0020, times entered 198, turns 735,103, writes of it under the frame interrupt 9,380, frames in all 10,479 |
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.
| at | entries | taken | chosen by the byte at |
|---|---|---|---|
| $8218 (bank 0) | 2 | 2 | $0770 |
| $8237 (bank 0) | 4 | 4 | $0772 |
| $856D (bank 0) | 15 | 14 | $073C |
| $92CB (bank 0) | 8 | 3 | $071F |
| $9667 (bank 0) | 25 | 2 | |
| $AEE2 (bank 0) | 2 | 2 | $0772 |
| $B04F (bank 0) | 9 | 3 | $000E |
| $B351 (bank 0) | 1 | 1 | $001D |
| $C128 (bank 1) | 17 | 5 | $0025 |
| $C227 (bank 1) | 2 | 2 | $0026 |
| $C907 (bank 1) | 4 | 3 | $0031, $0301 |
| $CCAE (bank 1) | 19 | 11 | $0031, $03A1 |
| $CE66 (bank 1) | 6 | 3 |
The memory its routines share
719 bytes of memory were written by one routine and read by another, and 75 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 |
|---|---|---|---|
| $0030 | 80 | 4 | 1 across, 1 down |
| $002A | 9 | 2 | 1 across, 1 down |
| $0200 | 256 | 11 | |
| $0300 | 256 | 9 | |
| $0500 | 256 | 3 | |
| $0000 | 256 | 2 | |
| $0400 | 256 | 2 | |
| $0600 | 256 | 1 | |
| $0700 | 256 | 1 | |
| $0341 | 145 | 4 | |
| $0342 | 141 | 2 | |
| $0343 | 141 | 2 |
The 24 busiest shared bytes
| byte | reads and writes | routines writing | routines reading |
|---|---|---|---|
| $0020 | 4,748,572 | 5 | 3 |
| $0007 | 3,999,872 | 6 | 6 |
| $0030 | 1,329,515 | 6 | 6 |
| $0037 | 606,859 | 6 | 6 |
| $0000 | 480,578 | 6 | 6 |
| $0034 | 340,913 | 6 | 6 |
| $0033 | 196,889 | 6 | 6 |
| $0032 | 192,747 | 6 | 6 |
| $0001 | 98,032 | 6 | 6 |
| $0003 | 89,709 | 6 | 6 |
| $0006 | 72,650 | 6 | 6 |
| $0004 | 42,975 | 6 | 6 |
| $0042 | 39,760 | 6 | 6 |
| $0038 | 37,602 | 6 | 6 |
| $003C | 37,602 | 6 | 6 |
| $0005 | 34,181 | 6 | 6 |
| $0028 | 32,403 | 3 | 6 |
| $0029 | 32,403 | 3 | 6 |
| $006D | 30,784 | 6 | 6 |
| $03A0 | 29,220 | 6 | 6 |
| $0035 | 28,312 | 6 | 6 |
| $0031 | 27,107 | 6 | 6 |
| $0040 | 26,424 | 6 | 6 |
| $03AD | 24,868 | 6 | 6 |
This page shows none of the game's bytes. The listing these figures were read from stays with the cartridge.