; Pyramid (U) application-specific RAM aliases - Pass 1 ; Generated from every direct zero-page operand in reachable code: ; ref counts are reads/writes, `where` lists the referencing addresses. ; ZpXX names indicate storage with a role not yet unique enough for a behavioral name; ; Pass 2 replaces them with names derived from observed usage. Zp00 = $00 ; 9 refs; reads=3 writes=6; used at $C0BF, C1A2, C401, C815, +5 more Zp01 = $01 ; 11 refs; reads=4 writes=7; used at $C0B3, C1EF, C843, C883, +7 more Zp02 = $02 ; 46 refs; reads=32 writes=14; used at $C063, C069, C070, C090, +41 more Zp03 = $03 ; 19 refs; reads=7 writes=12; used at $C065, C0BB, C0DD, C0FD, +14 more Zp04 = $04 ; 6 refs; reads=4 writes=2; used at $C120, C122, C127, C15D, +1 more Zp05 = $05 ; 8 refs; reads=1 writes=7; used at $C06B, C1AF, C31D, CA43, +4 more Zp06 = $06 ; 11 refs; reads=3 writes=8; used at $C072, C198, C1A8, C324, +6 more Zp07 = $07 ; 8 refs; reads=1 writes=7; used at $C84A, C8F4, C9D8, CA0B, +4 more Zp08 = $08 ; 12 refs; reads=7 writes=5; used at $C87C, C8B8, C8BA, C8BC, +4 more Zp09 = $09 ; 1 refs; reads=1 writes=0; used at $D768 Zp0A = $0A ; 9 refs; reads=5 writes=4; used at $C1C2, C1C4, C909, CBED, +4 more Zp0B = $0B ; 5 refs; reads=2 writes=3; used at $C90B, C925, CBEF, D791 Zp0C = $0C ; 4 refs; reads=1 writes=3; used at $C33B, D1EE, D1FF, D210 Zp0D = $0D ; 6 refs; reads=5 writes=1; used at $C1C9, C2A6, C2D2, C449, +1 more Zp0E = $0E ; 4 refs; reads=3 writes=1; used at $C1CD, C483, C48B Zp0F = $0F ; 5 refs; reads=3 writes=2; used at $DFFB, DFFF, E002, E004, +1 more Zp11 = $11 ; 1 refs; reads=0 writes=1; used at $E02D Zp12 = $12 ; 2 refs; reads=1 writes=1; used at $E02F, E036 Zp13 = $13 ; 7 refs; reads=4 writes=3; used at $E087, E08C, E0A0, E0A4, +3 more Zp15 = $15 ; 1 refs; reads=0 writes=1; used at $E0D2 Zp16 = $16 ; 2 refs; reads=1 writes=1; used at $E0D4, E0DB Zp17 = $17 ; 7 refs; reads=4 writes=3; used at $E12C, E131, E145, E149, +3 more Zp19 = $19 ; 1 refs; reads=0 writes=1; used at $E177 Zp1A = $1A ; 2 refs; reads=1 writes=1; used at $E179, E180 Zp1B = $1B ; 3 refs; reads=2 writes=1; used at $E1C2, E1C7, E24F Zp1F = $1F ; 3 refs; reads=1 writes=2; used at $DF9C, E049, E205 Zp20 = $20 ; 3 refs; reads=1 writes=2; used at $E059, E0EE, E220 Zp21 = $21 ; 3 refs; reads=1 writes=2; used at $E0FE, E193, E230 Zp22 = $22 ; 3 refs; reads=1 writes=2; used at $E1A3, E1F9, E249 Zp23 = $23 ; 6 refs; reads=2 writes=4; used at $DF01, DF14, DF92, DF96, +1 more Zp24 = $24 ; 4 refs; reads=2 writes=2; used at $E04F, E053, E0E7 Zp25 = $25 ; 4 refs; reads=2 writes=2; used at $E0F4, E0F8, E18C Zp26 = $26 ; 4 refs; reads=2 writes=2; used at $E199, E19D, E1E2 Zp27 = $27 ; 6 refs; reads=4 writes=2; used at $DED8, DFA3, DFCF, E03D, +1 more Zp28 = $28 ; 3 refs; reads=1 writes=2; used at $DEDD, E25E Zp29 = $29 ; 8 refs; reads=5 writes=3; used at $DEE2, E060, E085, E089, +3 more Zp2A = $2A ; 5 refs; reads=2 writes=3; used at $DEE7, E090, E094, E265 Zp2B = $2B ; 8 refs; reads=5 writes=3; used at $DEEC, E105, E12A, E12E, +3 more Zp2C = $2C ; 5 refs; reads=2 writes=3; used at $DEF1, E135, E139, E26C Zp2D = $2D ; 8 refs; reads=5 writes=3; used at $DEF6, E1AA, E1C0, E1C4, +3 more Zp2E = $2E ; 5 refs; reads=2 writes=3; used at $DEFB, E1CB, E1CF, E273 Zp2F = $2F ; 4 refs; reads=1 writes=3; used at $DF05, DF16, DF8E, DFBB Zp30 = $30 ; 2 refs; reads=1 writes=1; used at $E04B, E078 Zp31 = $31 ; 2 refs; reads=1 writes=1; used at $E0F0, E11D Zp32 = $32 ; 2 refs; reads=1 writes=1; used at $E195, E1B2 Zp33 = $33 ; 15 refs; reads=8 writes=7; used at $CA1D, CDF4, CDF9, CE06, +11 more Zp34 = $34 ; 5 refs; reads=4 writes=1; used at $DFD1, DFD8, E040, E0E5, +1 more Zp3D = $3D ; 2 refs; reads=1 writes=1; used at $C171 Zp3E = $3E ; 2 refs; reads=1 writes=1; used at $C17D Zp3F = $3F ; 5 refs; reads=3 writes=2; used at $C301, C303, C314, D72F, +1 more Zp40 = $40 ; 4 refs; reads=2 writes=2; used at $C305, C307, D735, D737 Zp41 = $41 ; 4 refs; reads=2 writes=2; used at $C309, C30B, D73B, D73D Zp42 = $42 ; 3 refs; reads=2 writes=1; used at $C30D, C30F, C312 Zp43 = $43 ; 1 refs; reads=1 writes=0; used at $C234 Zp44 = $44 ; 1 refs; reads=1 writes=0; used at $C225 Zp45 = $45 ; 105 refs; reads=53 writes=52; used at $C09E, C0A8, C23A, C241, +86 more Zp46 = $46 ; 69 refs; reads=36 writes=33; used at $C23D, C24C, C271, C27C, +56 more Zp47 = $47 ; 33 refs; reads=18 writes=15; used at $C34A, C364, C4C8, C4CE, +26 more Zp48 = $48 ; 22 refs; reads=13 writes=9; used at $C440, C467, C47B, C4A1, +17 more Zp49 = $49 ; 11 refs; reads=7 writes=4; used at $C43E, C44B, C462, C485, +6 more Zp4D = $4D ; 19 refs; reads=10 writes=9; used at $C5AB, C5C0, C5C6, C5E3, +12 more Zp4E = $4E ; 18 refs; reads=9 writes=9; used at $C5AE, C5C8, C5CE, C5EB, +11 more Zp4F = $4F ; 16 refs; reads=8 writes=8; used at $C5B1, C5D0, C5D8, C5FC, +9 more Zp50 = $50 ; 5 refs; reads=2 writes=3; used at $C5B8, C5DA, C5F9, C64B Zp55 = $55 ; 1 refs; reads=1 writes=0; used at $C61A Zp80 = $80 ; 1 refs; reads=1 writes=0; used at $D7D7 ZpAC = $AC ; 1 refs; reads=1 writes=0; used at $D7DB ZpD0 = $D0 ; 5 refs; reads=2 writes=3; used at $CF51, CF82, CF90, D1BB, +1 more ZpD1 = $D1 ; 2 refs; reads=1 writes=1; used at $CF80, CF92 ZpD2 = $D2 ; 3 refs; reads=1 writes=2; used at $D1D2, D1E7 ZpD4 = $D4 ; 2 refs; reads=1 writes=1; used at $CF60, CF69 ZpD5 = $D5 ; 5 refs; reads=2 writes=3; used at $C831, F89A, F8D5, F8DA ZpD6 = $D6 ; 5 refs; reads=2 writes=3; used at $C833, F8EF, F939, F93E ZpD7 = $D7 ; 2 refs; reads=1 writes=1; used at $C82B, F8A2 ZpD8 = $D8 ; 4 refs; reads=2 writes=2; used at $C82F, F8B0, F8B2 ZpD9 = $D9 ; 3 refs; reads=2 writes=1; used at $F8FE, F917, F91C ZpDA = $DA ; 4 refs; reads=3 writes=1; used at $F8F9, F920, F922 ZpDB = $DB ; 3 refs; reads=2 writes=1; used at $F8A5, F8A7, F8C8 ZpDC = $DC ; 3 refs; reads=2 writes=1; used at $F8AB, F8CF ZpDD = $DD ; 3 refs; reads=2 writes=1; used at $F90C, F90E, F92C ZpDE = $DE ; 3 refs; reads=2 writes=1; used at $F912, F933 ; --------------------------------------------------------------------------- ; Semantic zero-page aliases (Pass 3) ; ; Every alias below was read out of this dump's own code. The neutral ZpXX ; name stays on the same line so the file keeps both readings. ; ; $02/$03 the 16-bit pointer to the command script: every routine that ; reads the script uses (Zp02),y, and AdvanceScriptPointer at ; $C1D0 increments the pair ; $04 the command-list sync flag: set by FinishCommandList, waited ; on by FinishCommandList_Wait, tested by FlushVramCommandList ; $05/$06 the VRAM write position: BuildVramAddress at $C198 folds ; $06 into the low byte and $05 into the high byte of a ; $2000-based address ; $0A/$0B the 16-bit frame counter: incremented once per NMI at $D791 ; and used by AddToCounter as the value to wait for ; $0C the counter the three draw routines clear before they run ; $27/$28 the pointer to the sound tick script ; $29/$2A the pointer to the first sound player's script ; $2B/$2C the pointer to the second sound player's script ; $2D/$2E the pointer to the third sound player's script ; $3D/$3E the JOY1/JOY2 shift registers, filled by ReadControllers ; $43/$44 the sprite X and Y, written into OAM bytes 3 and 0 ; $4D/$4E/$4F the 24-bit delta the sound engine adds and subtracts ; $50 the per-voice wrap counter of the delta subtraction ; --------------------------------------------------------------------------- ScriptPtrLo = $02 ; semantic alias for Zp02 (the 16-bit command-script pointer) ScriptPtrHi = $03 ; semantic alias for Zp03 (the high byte of that pointer) CommandListFlag = $04 ; semantic alias for Zp04 (the command-list sync flag) VramPosHi = $05 ; semantic alias for Zp05 (the high bits of the VRAM write position) VramPosLo = $06 ; semantic alias for Zp06 (the low bits of the VRAM write position) FrameCounter = $0A ; semantic alias for Zp0A (the 16-bit frame counter) FrameCounterHi = $0B ; semantic alias for Zp0B (the high byte of the frame counter) DrawCounter = $0C ; semantic alias for Zp0C (the counter the draw routines clear) SoundTickScriptLo = $27 ; semantic alias for Zp27 (the sound tick script pointer) SoundTickScriptHi = $28 ; semantic alias for Zp28 (the high byte of that pointer) SoundPlayer1ScriptLo = $29 ; semantic alias for Zp29 (the first sound player's script pointer) SoundPlayer1ScriptHi = $2A ; semantic alias for Zp2A (the high byte of that pointer) SoundPlayer2ScriptLo = $2B ; semantic alias for Zp2B (the second sound player's script pointer) SoundPlayer2ScriptHi = $2C ; semantic alias for Zp2C (the high byte of that pointer) SoundPlayer3ScriptLo = $2D ; semantic alias for Zp2D (the third sound player's script pointer) SoundPlayer3ScriptHi = $2E ; semantic alias for Zp2E (the high byte of that pointer) Player1Input = $3D ; semantic alias for Zp3D (the JOY1 shift register) Player2Input = $3E ; semantic alias for Zp3E (the JOY2 shift register) SpriteX = $43 ; semantic alias for Zp43 (the sprite X, OAM byte 3) SpriteY = $44 ; semantic alias for Zp44 (the sprite Y, OAM byte 0) DeltaLo = $4D ; semantic alias for Zp4D (the 24-bit sound delta) DeltaMid = $4E ; semantic alias for Zp4E (the middle byte of the delta) DeltaHi = $4F ; semantic alias for Zp4F (the high byte of the delta) DeltaWrapCount = $50 ; semantic alias for Zp50 (the per-voice wrap counter) ; --------------------------------------------------------------------------- ; Slots that stay neutral, and why ; ; The aliases above are the ones whose role the ROM proves. Every slot ; below is listed with the reason it keeps its neutral ZpXX name: the role ; is either only visible inside one routine, or the address is reused for ; two different things, so a single name would be a guess. ; ; $00/$01 the two halves of a $20xx VRAM address in the boot and palette ; code, reused as plain scratch elsewhere ; $07/$08 the boot region's frame and state counters ; $09 one read, in a comparison that never leads anywhere ; $0D/$0E a 16-bit counter in one routine and a RAM pointer in another ; $0F a byte the sound player passes around ; $11/$12 the envelope bytes of the sound tick ; $13/$14 the envelope bytes of the first sound player ; $15/$16 the envelope bytes of the second sound player ; $17/$18 the envelope bytes of the third sound player ; $19/$1A the target bytes of the first sound player ; $1B/$1C the target bytes of the second and third sound players ; $1F a flag the sound player clears when it starts ; $20/$21/$22 the "finished" flag of each of the three sound players ; $23-$26 the four voices' envelope bytes, indexed by X ; $2F-$32 the four voices' flag bytes, indexed by X ; $33 the sound effect id and the "a voice is playing" flag ; $34 a counter ; $3F-$42 the 24-bit product accumulator of Multiply16 ; $45/$46 the general-purpose scratch of the shift and arithmetic helpers ; $47 the carry byte of those helpers ; $48/$49 the second and third operand slots of the delta helpers ; $55 one read, as the seed of a delta ; $80 the base of the indexed sound table ; $AC one comparison against a table byte ; $D0-$DE the sound engine's per-voice working bytes ; ---------------------------------------------------------------------------