Legend of Zelda, The (USA) (Rev 1)
Legend of Zelda, The (USA) (Rev 1) is on a MMC1 board with 131,072 bytes of program. A crawl of 400 steps from power-on kept 18 paths that found new code. Played back over 13,878 frames, they executed 4,548 bytes of it, 3 percent.
What the rules named
- The poll: 2
- The idle spin: 1
- The game inside the interrupt: 1
- The jump engine: 1
- The bank switch: 3
- The picture writer: 1
- The palette writers: 1
- The sprite writers: 10
- The scroll writer: 1
- The sound driver: 1
- The random byte: 3
The 83 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 |
|---|---|---|---|
| $FFAC (bank 7) | a call | 8,128 | The bank switch: writes 40,640, in the blank 13,619, while drawing 27,021 |
| $E5E2 (bank 7) | a call | 5,934 | The jump engine: tables 7, jumps through them 5,934 |
| $98F5 (bank 2) | a call | 4,230 | The sprite writers: frames it ran in 1,410, writes to the sprite page 67,680 |
| $A0F6 (bank 6) | a call | 2,616 | The palette writers: frames it ran in 2,616, writes 2,800 The picture writer: frames it ran in 2,616, writes 27,706, in the blank 8,169, while drawing 19,537 |
| $E484 (bank 7) | each frame (NMI) | 2,616 | The game inside the interrupt: frames it ran in 2,729, frames in all 3,378, the spin is at $E45B The random byte: frames it ran in 2,729, bytes $0018,$0019,$001A, rotates 3, exclusive-ors 1 The scroll writer: frames it ran in 2,729, writes in the blank 8,082 |
| $E62D (bank 7) | a call | 2,615 | The poll: port $4017, reads a frame 17, strobes a frame 6 The random byte: frames it ran in 2,695, bytes $0000,$00F8,$00F9, rotates 3, exclusive-ors 1 |
| $E640 (bank 7) | a call | 2,615 | The poll: port $4016, reads a frame 18, strobes a frame 4 The random byte: frames it ran in 2,615, bytes $0000,$00F8,$00F9, rotates 3, exclusive-ors 1 |
| $9C67 (bank 0) | a call | 2,598 | The sound driver: frames it ran in 2,598, writes 11,544 |
| $986B (bank 2) | a call | 1,410 | The sprite writers: frames it ran in 1,410, writes to the sprite page 157,920 |
| $9943 (bank 2) | a call | 1,410 | The sprite writers: frames it ran in 1,410, writes to the sprite page 22,560 |
| $9EF0 (bank 2) | a table | 528 | The sprite writers: frames it ran in 528, writes to the sprite page 528 |
| $A1C3 (bank 2) | a call | 528 | The sprite writers: frames it ran in 528, writes to the sprite page 1,056 |
| $A1DD (bank 2) | a call | 528 | The sprite writers: frames it ran in 528, writes to the sprite page 1,056 |
| $A204 (bank 2) | a call | 528 | The sprite writers: frames it ran in 528, writes to the sprite page 3 |
| $A59A (bank 2) | a table | 326 | The sprite writers: frames it ran in 326, writes to the sprite page 1,252 |
| $E5F7 (bank 7) | a call | 80 | The sprite writers: frames it ran in 80, writes to the sprite page 5,120 |
| $FF50 (bank 7) | power-on | 18 | The bank switch: writes 162, in the blank 162, while drawing 0 |
| $FF98 (bank 7) | a call | 18 | The bank switch: writes 90, in the blank 90, while drawing 0 |
| $A18E (bank 2) | a call | 13 | The sprite writers: frames it ran in 13, writes to the sprite page 180 |
| $A351 (bank 2) | a call | 83,520 | |
| $A42B (bank 2) | a call | 16,965 | |
| $9C50 (bank 0) | a call | 4,278 | |
| $9F7C (bank 0) | a call | 2,852 | |
| $A080 (bank 6) | a call | 2,616 | |
| $9825 (bank 0) | a call | 2,598 | |
| $98CC (bank 0) | a call | 2,598 | |
| $99A0 (bank 0) | a call | 2,598 | |
| $9AD3 (bank 0) | a call | 2,598 | |
| $9B83 (bank 0) | a call | 2,598 | |
| $EB30 (bank 7) | a call | 2,318 | |
| $9020 (bank 2) | a table | 1,442 | |
| $903B (bank 2) | a table | 1,410 | |
| $90CF (bank 2) | a call | 1,410 | |
| $95AC (bank 2) | a table | 1,410 | |
| $98C3 (bank 2) | a call | 1,410 | |
| $A1F7 (bank 2) | a call | 1,056 | |
| $A011 (bank 2) | a call | 528 | |
| $E625 (bank 7) | a call | 403 | |
| $A591 (bank 2) | a table | 339 | |
| $E8F8 (bank 7) | a call | 280 | |
| $A307 (bank 2) | a call | 192 | |
| $E96F (bank 7) | a table | 112 | |
| $9EE2 (bank 0) | a call | 102 | |
| $A35D (bank 2) | a call | 96 | |
| $E94B (bank 7) | a table | 85 | |
| $9D2A (bank 2) | a call | 78 | |
| $9C27 (bank 0) | a call | 77 | |
| $9FDE (bank 2) | a call | 65 | |
| $E9C3 (bank 7) | a table | 65 | |
| $E47D (bank 7) | a call | 64 | |
| $E580 (bank 7) | a call | 64 | |
| $9C09 (bank 0) | a call | 54 | |
| $804F (bank 2) | a call | 51 | |
| $9C3B (bank 0) | a call | 51 | |
| $A4C4 (bank 2) | a table | 48 | |
| $E46D (bank 7) | a call | 46 | |
| $A3E1 (bank 2) | a call | 39 | |
| $A437 (bank 2) | a call | 39 | |
| $8D84 (bank 1) | a call | 34 | |
| $9BFF (bank 0) | a call | 34 | |
| $9C1D (bank 0) | a call | 34 | |
| $9EDC (bank 0) | a call | 34 | |
| $9F72 (bank 0) | a call | 34 | |
| $A2A0 (bank 2) | a table | 32 | |
| $808C (bank 6) | a call | 18 | |
| $80C6 (bank 6) | a call | 18 | |
| $80D7 (bank 6) | a call | 18 | |
| $8D00 (bank 1) | a call | 18 | |
| $B4AC (bank 5) | a call | 18 | |
| $B4E8 (bank 5) | a call | 18 | |
| $E45E (bank 7) | a call | 18 | |
| $E608 (bank 7) | a call | 18 | |
| $94E7 (bank 2) | a table | 17 | |
| $9512 (bank 2) | a table | 17 | |
| $9545 (bank 2) | a table | 17 | |
| $905D (bank 2) | a table | 16 | |
| $A47F (bank 2) | a table | 16 | |
| $A4BD (bank 2) | a table | 16 | |
| $A51E (bank 2) | a table | 16 | |
| $A0F0 (bank 2) | a call | 13 | |
| $A5DF (bank 2) | a table | 13 | |
| $9FC5 (bank 2) | a table | 9 | |
| $A017 (bank 2) | a call | 2 |
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 |
|---|---|
| $E45B (bank 7) | The idle spin: turns 19,870,380, turns a frame 5,882 |
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 |
|---|---|---|---|
| $900E (bank 2) | 3 | 3 | $042D |
| $9035 (bank 2) | 3 | 3 | $0013 |
| $90DA (bank 2) | 1 | 1 | $042D |
| $A292 (bank 2) | 7 | 5 | $0013 |
| $A596 (bank 2) | 2 | 2 | $0013 |
| $E923 (bank 7) | 2 | 3 | $0012, $0016 |
The memory its routines share
564 bytes of memory were written by one routine and read by another, and 28 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 |
|---|---|---|---|
| $0201 | 253 | 4 | |
| $0200 | 253 | 3 | |
| $0202 | 253 | 2 | |
| $0203 | 253 | 2 | |
| $0000 | 240 | 6 | |
| $01FF | 113 | 1 | |
| $0302 | 52 | 9 | |
| $0305 | 44 | 2 | |
| $0001 | 25 | 1 | |
| $0638 | 24 | 3 | |
| $0309 | 18 | 1 | |
| $0303 | 16 | 1 |
The 24 busiest shared bytes
| byte | reads and writes | routines writing | routines reading |
|---|---|---|---|
| $0000 | 1,642,778 | 6 | 6 |
| $0001 | 1,484,137 | 6 | 6 |
| $0002 | 1,115,850 | 6 | 6 |
| $0003 | 683,639 | 6 | 6 |
| $00F8 | 291,352 | 1 | 6 |
| $000E | 169,024 | 5 | 6 |
| $000F | 168,208 | 5 | 5 |
| $0004 | 35,283 | 6 | 6 |
| $0005 | 28,516 | 6 | 6 |
| $00FA | 16,443 | 1 | 3 |
| $0015 | 15,931 | 2 | 5 |
| $0014 | 7,975 | 6 | 3 |
| $00E3 | 7,882 | 1 | 2 |
| $0007 | 7,582 | 5 | 5 |
| $0011 | 6,826 | 6 | 6 |
| $0302 | 6,049 | 6 | 6 |
| $005C | 5,268 | 2 | 2 |
| $0600 | 5,265 | 4 | 2 |
| $0602 | 5,259 | 5 | 2 |
| $0604 | 5,252 | 4 | 2 |
| $00E0 | 5,249 | 1 | 3 |
| $0601 | 5,232 | 2 | 2 |
| $0012 | 5,075 | 3 | 6 |
| $6E07 | 4,848 | 2 | 3 |
This page shows none of the game's bytes. The listing these figures were read from stays with the cartridge.