Ninja Gaiden (USA)
Ninja Gaiden (USA) is on a MMC1 board with 131,072 bytes of program. A crawl of 400 steps from power-on kept 36 paths that found new code. Played back over 24,896 frames, they executed 8,601 bytes of it, 7 percent.
What the rules named
- The poll: 1
- The wait for the frame: 3
- The jump engine: 2
- The bank switch: 12
- The picture writer: 1
- The palette writers: 1
- The sprite writers: 9
- The scroll writer: 1
- The split: 3
- The sound driver: 1
The 123 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 |
|---|---|---|---|
| $80F4 (bank 3) | a call | 36,011 | The sound driver: frames it ran in 9,074, writes 102,492 |
| $E819 (bank 7) | a call | 28,174 | The poll: port $4016, reads a frame 15, strobes a frame 3 |
| $C028 (bank 7) | a call | 21,686 | The bank switch: writes 108,349, in the blank 0, while drawing 108,349 |
| $C02A (bank 7) | a call | 17,612 | The bank switch: writes 88,029, in the blank 0, while drawing 88,029 |
| $80A8 (bank 5) | a call | 17,372 | The jump engine: tables 1, jumps through them 17,372 |
| $F91A (bank 7) | each frame (NMI) | 14,087 | The bank switch: writes 308,539, in the blank 260,271, while drawing 48,268 The palette writers: frames it ran in 14,148, writes 118,694 The scroll writer: frames it ran in 14,148, writes in the blank 28,174 The picture writer: frames it ran in 14,148, writes 151,036, in the blank 151,036, while drawing 0 |
| $823B (bank 4) | a call | 8,693 | The wait for the frame: waits on the byte at $001F, times entered 8,692, turns 12,877,382, writes of it under the frame interrupt 14,057, frames in all 14,396 |
| $8181 (bank 4) | a call | 8,686 | The sprite writers: frames it ran in 8,686, writes to the sprite page 527,376 |
| $F104 (bank 7) | a call | 5,096 | The wait for the frame: waits on the byte at $001F, times entered 5,116, turns 16,857,610, writes of it under the frame interrupt 14,057, frames in all 14,396 |
| $F5A2 (bank 7) | a call | 4,954 | The bank switch: writes 49,467, in the blank 0, while drawing 49,467 The split: frames it ran in 4,953, scroll writes while drawing 9,897, status reads while drawing 3,417,661 |
| $8013 (bank 5) | a call | 2,454 | The sprite writers: frames it ran in 2,454, writes to the sprite page 78,408 |
| $F768 (bank 7) | a call | 1,154 | The sprite writers: frames it ran in 1,154, writes to the sprite page 72,654 |
| $F0A7 (bank 7) | a call | 1,125 | The sprite writers: frames it ran in 1,125, writes to the sprite page 19,813 |
| $D8D5 (bank 7) | a call | 1,107 | The bank switch: writes 5,529, in the blank 0, while drawing 5,529 |
| $F47E (bank 7) | a call | 504 | The bank switch: writes 5,040, in the blank 0, while drawing 5,040 |
| $8301 (bank 4) | a call | 269 | The wait for the frame: waits on the byte at $001F, times entered 269, turns 756,096, writes of it under the frame interrupt 14,057, frames in all 14,396 |
| $F5EA (bank 7) | a call | 251 | The bank switch: writes 1,255, in the blank 0, while drawing 1,255 |
| $818E (bank 6) | a call | 240 | The jump engine: tables 1, jumps through them 240 |
| $81E9 (bank 4) | a call | 199 | The bank switch: writes 995, in the blank 0, while drawing 995 |
| $86D2 (bank 4) | a call | 133 | The sprite writers: frames it ran in 133, writes to the sprite page 133 |
| $817D (bank 4) | a call | 131 | The sprite writers: frames it ran in 131, writes to the sprite page 8,253 |
| $8328 (bank 4) | a call | 102 | The sprite writers: frames it ran in 102, writes to the sprite page 408 |
| $FFDA (bank 7) | power-on | 36 | The bank switch: writes 252, in the blank 252, while drawing 0 The sprite writers: frames it ran in 108, writes to the sprite page 9,216 |
| $E902 (bank 7) | a call | 29 | The bank switch: writes 270, in the blank 0, while drawing 270 |
| $EAC1 (bank 7) | a call | 29 | The bank switch: writes 290, in the blank 0, while drawing 290 The split: frames it ran in 116, scroll writes while drawing 58, status reads while drawing 21,286 The sprite writers: frames it ran in 116, writes to the sprite page 116 |
| $F8F0 (bank 7) | a call | 29 | The bank switch: writes 290, in the blank 0, while drawing 290 The split: frames it ran in 58, scroll writes while drawing 58, status reads while drawing 19,923 |
| $8161 (bank 3) | a call | 37,495 | |
| $BF98 (bank 4) | a call | 17,612 | |
| $BFB3 (bank 5) | a call | 17,372 | |
| $8000 (bank 3) | a call | 14,085 | |
| $8003 (bank 5) | a table | 8,686 | |
| $8006 (bank 5) | a table | 8,686 | |
| $83A9 (bank 4) | a call | 8,686 | |
| $83B5 (bank 4) | a call | 8,686 | |
| $81D7 (bank 6) | a call | 6,940 | |
| $81C8 (bank 6) | a call | 6,700 | |
| $82B9 (bank 3) | a call | 6,139 | |
| $81A4 (bank 6) | a call | 5,704 | |
| $81B5 (bank 6) | a call | 5,704 | |
| $81E5 (bank 6) | a call | 5,704 | |
| $E792 (bank 7) | a call | 5,445 | |
| $82E0 (bank 4) | a call | 4,234 | |
| $867F (bank 4) | a call | 3,205 | |
| $F53E (bank 7) | a call | 3,024 | |
| $F568 (bank 7) | a call | 3,024 | |
| $837A (bank 3) | a call | 3,020 | |
| $8193 (bank 5) | a call | 2,454 | |
| $80D6 (bank 5) | a call | 2,422 | |
| $87A0 (bank 4) | a call | 1,383 | |
| $84D7 (bank 3) | a table | 1,245 | |
| $D85D (bank 7) | a call | 1,125 | |
| $DC88 (bank 7) | a call | 1,125 | |
| $EB64 (bank 7) | a call | 1,125 | |
| $F10D (bank 7) | a call | 1,125 | |
| $D710 (bank 7) | a call | 1,107 | |
| $D9E4 (bank 7) | a call | 1,107 | |
| $DD32 (bank 7) | a call | 1,107 | |
| $E560 (bank 7) | a call | 1,107 | |
| $E625 (bank 7) | a call | 1,107 | |
| $E677 (bank 7) | a call | 1,107 | |
| $EB7B (bank 7) | a call | 1,107 | |
| $EFF1 (bank 7) | a call | 1,107 | |
| $F1AC (bank 7) | a call | 1,107 | |
| $F7E4 (bank 7) | a call | 1,107 | |
| $8225 (bank 3) | a table | 884 | |
| $820A (bank 3) | a table | 883 | |
| $81F0 (bank 3) | a table | 852 | |
| $EC7B (bank 7) | a table | 741 | |
| $8535 (bank 3) | a table | 638 | |
| $822F (bank 4) | a call | 577 | |
| $F2DD (bank 7) | a call | 504 | |
| $81AA (bank 4) | a call | 466 | |
| $823A (bank 3) | a table | 427 | |
| $8205 (bank 3) | a table | 426 | |
| $83CB (bank 3) | a table | 300 | |
| $8340 (bank 4) | a call | 256 | |
| $8398 (bank 4) | a call | 256 | |
| $8000 (bank 6) | a table | 240 | |
| $8157 (bank 6) | a call | 240 | |
| $8166 (bank 6) | a call | 240 | |
| $BFB3 (bank 6) | a call | 240 | |
| $8192 (bank 4) | a call | 233 | |
| $81CF (bank 4) | a call | 233 | |
| $81DE (bank 4) | a call | 233 | |
| $8243 (bank 3) | a call | 216 | |
| $E2C3 (bank 7) | a call | 216 | |
| $F745 (bank 7) | a call | 216 | |
| $8471 (bank 3) | a table | 213 | |
| $83E6 (bank 3) | a table | 208 | |
| $F85D (bank 7) | a table | 200 | |
| $81FD (bank 4) | a call | 197 | |
| $F850 (bank 7) | a table | 187 | |
| $F86F (bank 7) | a table | 187 | |
| $F83E (bank 7) | a table | 179 | |
| $F86A (bank 7) | a table | 179 | |
| $F831 (bank 7) | a table | 175 | |
| $EDB1 (bank 7) | a table | 136 | |
| $ED0D (bank 7) | a table | 135 | |
| $85EB (bank 4) | a call | 132 | |
| $84C3 (bank 3) | a table | 123 | |
| $EEE7 (bank 7) | a call | 121 | |
| $8448 (bank 3) | a table | 117 | |
| $80BE (bank 4) | a call | 102 | |
| $860A (bank 4) | a call | 66 | |
| $868D (bank 4) | a call | 66 | |
| $F62D (bank 7) | a call | 58 | |
| $EE55 (bank 7) | a table | 57 | |
| $8407 (bank 3) | a table | 56 | |
| $EE99 (bank 7) | a table | 38 | |
| $8000 (bank 4) | a call | 36 | |
| $E526 (bank 7) | a call | 36 | |
| $8500 (bank 3) | a table | 32 | |
| $850D (bank 3) | a table | 30 | |
| $E7DC (bank 7) | a call | 29 | |
| $E7E7 (bank 7) | a call | 29 | |
| $F0F3 (bank 7) | a call | 29 | |
| $83FA (bank 3) | a table | 28 | |
| $84F2 (bank 3) | a table | 28 | |
| $D97C (bank 7) | a call | 27 | |
| $E30A (bank 7) | a call | 27 | |
| $F653 (bank 7) | a call | 27 | |
| $F6B5 (bank 7) | a call | 27 | |
| $8431 (bank 3) | a table | 2 |
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 |
|---|---|---|---|
| $BFB6 (bank 5) | 3 | 2 | |
| $BFB6 (bank 6) | 1 | 1 |
The memory its routines share
364 bytes of memory were written by one routine and read by another, and 45 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 |
|---|---|---|---|
| $0300 | 256 | 2 | |
| $0200 | 253 | 4 | |
| $0203 | 253 | 3 | |
| $0201 | 253 | 2 | |
| $0202 | 253 | 2 | |
| $0627 | 113 | 1 | |
| $0628 | 113 | 1 | |
| $062C | 113 | 1 | |
| $0630 | 113 | 1 | |
| $0340 | 49 | 2 | |
| $0700 | 35 | 4 | |
| $03A3 | 32 | 6 |
The 24 busiest shared bytes
| byte | reads and writes | routines writing | routines reading |
|---|---|---|---|
| $0028 | 737,493 | 3 | 6 |
| $00F0 | 691,793 | 3 | 6 |
| $00F3 | 669,677 | 2 | 6 |
| $00F2 | 608,412 | 2 | 5 |
| $00F1 | 468,867 | 3 | 6 |
| $0000 | 272,189 | 6 | 6 |
| $0001 | 239,632 | 6 | 6 |
| $0002 | 98,806 | 6 | 6 |
| $033F | 56,776 | 5 | 5 |
| $005C | 53,461 | 3 | 3 |
| $00F4 | 51,827 | 6 | 6 |
| $00F5 | 45,592 | 6 | 6 |
| $001C | 42,477 | 6 | 6 |
| $0380 | 41,832 | 3 | 3 |
| $00E4 | 32,060 | 3 | 5 |
| $00E5 | 32,060 | 3 | 5 |
| $066D | 27,677 | 2 | 3 |
| $067D | 27,676 | 2 | 3 |
| $064D | 27,154 | 2 | 3 |
| $00A7 | 27,118 | 5 | 4 |
| $069D | 26,954 | 2 | 3 |
| $0626 | 25,367 | 2 | 3 |
| $067C | 23,748 | 5 | 6 |
| $069C | 23,610 | 4 | 6 |
This page shows none of the game's bytes. The listing these figures were read from stays with the cartridge.