; Lunar Pool (U) application-specific RAM aliases ; Generated from every direct zero-page operand in reachable code. ; ref counts are reads+writes; `used at` lists up to four distinct CPU addresses. ; A reference is an operand-position mention in the disassembled instruction stream, ; including the "-- " comment of a .byte line that stands in for an ; undocumented opcode. sta/stx/sty write; inc/dec/asl/lsr/rol/ror and the ; undocumented read-modify-write set slo/rla/sre/rra/dcp/isc read and write; ; everything else reads. The counts were refreshed after the Pass 3 ; reclassification below, so they describe the current prg.s, not the Pass 1 trace. ; ZpXX names indicate storage with a role not yet unique enough for a behavioral name. ; Pass 2 named the entries whose role was already unambiguous. ; Pass 3 re-traced every remaining ZpXX and named the ones whose behaviour is provable ; from the instruction contexts that touch them; the rest stay neutral on purpose. ; See the Pass 3 notes at the bottom of this file for the evidence and the residue. timer_lo = $00 ; 28 refs; reads=16 writes=12; used at $CB45, CB49, CB52, CB61, +21 more timer_hi = $01 ; 32 refs; reads=17 writes=15; used at $CA79, CB4D, CB50, CB66, +26 more Zp02 = $02 ; 6 refs; reads=4 writes=2; used at $E295, E844, EAFA, EB0D, +1 more Zp03 = $03 ; 8 refs; reads=4 writes=4; used at $E8E6, E9FB, EE48, EE4A, +1 more Zp04 = $04 ; 3 refs; reads=2 writes=1; used at $F68F, F725 Zp05 = $05 ; 12 refs; reads=6 writes=6; used at $E8EB, EE3C, F211, F2AF, +5 more Zp06 = $06 ; 3 refs; reads=1 writes=2; used at $EE32, F2E5 Zp07 = $07 ; 22 refs; reads=16 writes=6; used at $EE55, EE57, EEC7, EF04, +16 more Zp08 = $08 ; 7 refs; reads=5 writes=2; used at $F032, F236, F287, F2BC, +2 more Zp09 = $09 ; 3 refs; reads=1 writes=2; used at $CFC4, D2BC, D2E7 Zp0C = $0C ; 4 refs; reads=2 writes=2; used at $E29A, E300, E309 Zp0D = $0D ; 7 refs; reads=4 writes=3; used at $E240, E302, E314, E8F0, +1 more Zp0E = $0E ; 5 refs; reads=3 writes=2; used at $E245, E31A, EBFD, F5EE Zp0F = $0F ; 1 refs; reads=0 writes=1; used at $E8A1 Zp10 = $10 ; 3 refs; reads=1 writes=2; used at $E3FF, E655, FBC8 Zp11 = $11 ; 4 refs; reads=2 writes=2; used at $E405, E659, E6F8, FBCA Zp12 = $12 ; 4 refs; reads=3 writes=1; used at $E666, F2A0, FBCC, FC8E Zp13 = $13 ; 6 refs; reads=5 writes=1; used at $E66A, E6FC, E70F, F2A4, +2 more Zp15 = $15 ; 2 refs; reads=1 writes=1; used at $F5F0 Zp16 = $16 ; 4 refs; reads=2 writes=2; used at $F080, F14E, F196, F29D Zp17 = $17 ; 4 refs; reads=2 writes=2; used at $F084, F152, F193, F2A2 Zp18 = $18 ; 4 refs; reads=2 writes=2; used at $E698, E6CA, FC79, FCB3 Zp19 = $19 ; 4 refs; reads=2 writes=2; used at $E696, E6ED, FC7B, FCB7 Zp1A = $1A ; 2 refs; reads=1 writes=1; used at $FC99, FCCA Zp1B = $1B ; 2 refs; reads=1 writes=1; used at $FC9B, FCCE Zp1C = $1C ; 8 refs; reads=4 writes=4; used at $E61E, E662, EF5A, F1E2, +4 more Zp1D = $1D ; 8 refs; reads=5 writes=3; used at $EF62, EF8A, EFDF, F1E7, +4 more Zp1E = $1E ; 9 refs; reads=5 writes=4; used at $E625, E673, EF6C, F1EC, +5 more Zp1F = $1F ; 9 refs; reads=6 writes=3; used at $EF74, EF84, EFD9, F1F1, +5 more Zp20 = $20 ; 5 refs; reads=4 writes=1; used at $FBAD, FBEC, FC3A, FC7D, +1 more Zp21 = $21 ; 5 refs; reads=4 writes=1; used at $FBA8, FBF0, FC3E, FC81, +1 more Zp22 = $22 ; 5 refs; reads=4 writes=1; used at $FBBE, FC18, FC51, FC9D, +1 more Zp23 = $23 ; 5 refs; reads=4 writes=1; used at $FBB9, FC1C, FC55, FCA1, +1 more Zp24 = $24 ; 26 refs; reads=10 writes=16; used at $E3D6, E3EF, E6AB, E6BC, +20 more Zp25 = $25 ; 23 refs; reads=11 writes=12; used at $E3D4, E3F5, E6A9, E6C1, +18 more Zp26 = $26 ; 20 refs; reads=11 writes=9; used at $E3C4, E443, E51A, E59F, +15 more Zp27 = $27 ; 5 refs; reads=1 writes=4; used at $E3DD, E448, E51F, E5A4, +1 more Zp28 = $28 ; 8 refs; reads=6 writes=2; used at $E3CE, E67A, E68E, E694, +4 more Zp29 = $29 ; 5 refs; reads=3 writes=2; used at $E3E7, E683, E6AD, F268, +1 more Zp2A = $2A ; 5 refs; reads=2 writes=3; used at $E31F, E34D, E373, E3BB, +1 more Zp2B = $2B ; 4 refs; reads=2 writes=2; used at $E360, E53E, E55D, E57D Zp2C = $2C ; 9 refs; reads=2 writes=7; used at $E3C1, E43E, E50E, E515, +4 more Zp2D = $2D ; 9 refs; reads=2 writes=7; used at $E3DA, E43B, E502, E509, +4 more Zp2E = $2E ; 10 refs; reads=5 writes=5; used at $E487, E4B2, E4D5, E4DE, +6 more Zp2F = $2F ; 6 refs; reads=2 writes=4; used at $E485, E4BB, E4FB, E529, +2 more Zp30 = $30 ; 4 refs; reads=2 writes=2; used at $E39D, E555, E55B, E57B Zp31 = $31 ; 8 refs; reads=4 writes=4; used at $E384, E527, E540, E550, +4 more Zp32 = $32 ; 23 refs; reads=17 writes=6; used at $E413, E417, E457, E46C, +16 more Zp33 = $33 ; 17 refs; reads=12 writes=5; used at $E415, E41B, E429, E455, +10 more Zp34 = $34 ; 17 refs; reads=11 writes=6; used at $E71F, E721, E74F, E763, +11 more Zp35 = $35 ; 14 refs; reads=7 writes=7; used at $E4E0, E4E4, E55F, E56A, +6 more Zp36 = $36 ; 2 refs; reads=1 writes=1; used at $E5F8, E617 Zp37 = $37 ; 5 refs; reads=2 writes=3; used at $EBC1, F321, F41B, F41D Zp5F = $5F ; 6 refs; reads=3 writes=3; used at $C3C0, E85D, E8A6, F2EF, +1 more spawn_queue = $60 ; 4 refs; reads=2 writes=2; used at $C00E, C019, C3E0, C3E6 Zp61 = $61 ; 2 refs; reads=1 writes=1; used at $F521 game_flag = $68 ; 3 refs; reads=1 writes=2; used at $C003, C3F7, CE37 obj_script_lo = $69 ; 17 refs; reads=13 writes=4; used at $C085, C096, C0BD, C0E9, +12 more obj_script_hi = $6A ; 6 refs; reads=2 writes=4; used at $C08A, C0EB, C1E7, C401, +1 more obj_ptr_lo = $6B ; 35 refs; reads=20 writes=15; used at $C0F8, C13D, C141, C146, +30 more obj_ptr_hi = $6C ; 12 refs; reads=4 writes=8; used at $C199, C1AD, C209, C217, +7 more obj_index = $6D ; 17 refs; reads=14 writes=3; used at $C00C, C015, C02C, C02E, +12 more Zp6E = $6E ; 5 refs; reads=2 writes=3; used at $C231, C283, C39F, C404, +1 more Zp6F = $6F ; 19 refs; reads=9 writes=10; used at $C024, C150, C156, C15E, +14 more Zp70 = $70 ; 1 refs; reads=1 writes=0; used at $C072 Zp74 = $74 ; 2 refs; reads=1 writes=1; used at $EBF1 Zp7F = $7F ; 2 refs; reads=0 writes=2; used at $E832, FA93 ; --- palette shadow $0080-$009F ------------------------------------------------ ; The 32 bytes FlushPaletteToPpu writes to PPU $3F00-$3F1F at the end of every NMI. ; $0080-$008F are the four background palettes and $0090-$009F the four sprite ; palettes; Reset_LoadSpritePalettes fills the sprite half from the ROM table at ; $ED3F. The ZpXX entries below are the individual slots that reachable code ; touches directly (the title colour cycle writes $85-$87, the aiming display ; writes $8B/$8F/$92). palette_shadow = $80 sprite_palette_shadow = $90 Zp85 = $85 ; 1 refs; reads=0 writes=1; used at $E9A0 Zp86 = $86 ; 1 refs; reads=0 writes=1; used at $E995 Zp87 = $87 ; 1 refs; reads=0 writes=1; used at $E98A Zp89 = $89 ; 1 refs; reads=0 writes=1; used at $E963 Zp8B = $8B ; 1 refs; reads=0 writes=1; used at $EDE2 Zp8F = $8F ; 2 refs; reads=0 writes=2; used at $E84B, EDDD Zp92 = $92 ; 2 refs; reads=0 writes=2; used at $EABF, EDD8 vram_buf = $A0 ; 1 refs; reads=0 writes=1; used at $CC50 ZpA5 = $A5 ; 1 refs; reads=1 writes=0; used at $F0CF vram_slot_len = $D0 ; 5 refs; reads=3 writes=2; used at $CC05, CC36, CC4B, CC7F vram_slot_ofs = $D1 ; 2 refs; reads=0 writes=2; used at $CC19, CC47 vram_slot_addr_lo = $D2 ; 1 refs; reads=0 writes=1; used at $CC3C vram_slot_addr_hi = $D3 ; 1 refs; reads=0 writes=1; used at $CC40 vram_read_len = $E8 ; 4 refs; reads=2 writes=2; used at $CCC5, CCE2, F7BA, F7BC vram_read_addr_lo = $E9 ; 4 refs; reads=3 writes=1; used at $CCCF, F7AB, F7C2, F7D0 vram_read_addr_hi = $EA ; 4 refs; reads=3 writes=1; used at $CCCA, F7A9, F7C0, F7CE vram_read_dst_lo = $EB ; 2 refs; reads=0 writes=2; used at $CCDC, F7B6 vram_read_dst_hi = $EC ; 1 refs; reads=0 writes=1; used at $F7B2 vram_slot_idx = $ED ; 3 refs; reads=1 writes=2; used at $CC12, CC34, CC8A vram_queue_len = $EE ; 9 refs; reads=6 writes=3; used at $CBFD, CC17, CC2E, CC45, +4 more vram_update_checksum = $EF ; 5 refs; reads=3 writes=2; used at $CAB4, CAB6, CDBB, CDC9, +1 more ppu_ctrl_shadow = $F0 ; 14 refs; reads=9 writes=5; used at $CA38, CA3F, CA48, CA4C, +8 more ppu_mask_shadow = $F1 ; 7 refs; reads=4 writes=3; used at $CA24, CA2B, CA2E, CA32, +3 more nt_base_hi = $F2 ; 6 refs; reads=3 writes=3; used at $CA68, CA7F, CA88, CB19, +2 more nt_base_lo = $F3 ; 5 refs; reads=2 writes=3; used at $CA6C, CA83, CA8C, CD4B, +1 more ppu_addr_save_lo = $F4 ; 2 refs; reads=1 writes=1; used at $CC20, CC3A ppu_addr_save_hi = $F5 ; 2 refs; reads=1 writes=1; used at $CC24, CC3E ppu_addr_temp_lo = $F6 ; 68 refs; reads=35 writes=33; used at $CAFB, CAFD, CB01, CB05, +52 more ppu_addr_temp_hi = $F7 ; 42 refs; reads=20 writes=22; used at $CAF9, CAFF, CB03, CB07, +29 more ppu_src_lo = $F8 ; 55 refs; reads=28 writes=27; used at $CE4E, CE7A, CEB4, CEE7, +46 more ppu_src_hi = $F9 ; 41 refs; reads=20 writes=21; used at $CE4C, CE7E, CEB8, CEE5, +36 more ptr_lo = $FA ; 68 refs; reads=24 writes=44; used at $CB71, CB87, CB95, CB9B, +61 more ptr_hi = $FB ; 67 refs; reads=25 writes=42; used at $CB9D, CBA3, CBCD, CBD5, +58 more ppu_addr_lo = $FC ; 153 refs; reads=63 writes=90; used at $CAA8, CB97, CB99, CBAB, +129 more ppu_addr_hi = $FD ; 111 refs; reads=45 writes=66; used at $CAA3, CB9F, CBA1, CBA9, +94 more ppu_addr_src_lo = $FE ; 40 refs; reads=23 writes=17; used at $CDD8, CE19, CE83, CECB, +36 more ppu_addr_src_hi = $FF ; 22 refs; reads=9 writes=13; used at $CDD6, CE14, CE86, CEC8, +18 more ; ================================================================================= ; Pass 3 notes - zero-page audit (rebuild re-verified byte-identical after the pass) ; ; Named in Pass 3 (20 entries; the proof is the instruction context on each line): ; ; Object core ($C000-$C4FF) ; obj_index $6D current object slot 0..4; indexes the $0500/$0514/$056E ; per-object arrays and is saved/restored around jsr $C404. ; obj_script_lo $69 per-object behaviour-script pointer. Copied from the ; obj_script_hi $6A $0528/$052D pointer tables, read with (..),y to fetch the ; next script byte, advanced by $C3FC/$C401, saved per object ; in $0546/$054B. ; spawn_queue $60 8-slot FIFO of entity-type spawn requests: filled by $C3DA ; (`lda #imm / jsr $C3DA`), drained by the $C00C loop which ; hands each entry to $C404 and clears the slot. ; ; VRAM write queue ($CBFD-$CC91) ; vram_buf $A0 staging buffer base; queued bytes land in vram_buf,x where ; x is the running queue length. ; vram_queue_len $EE bytes currently staged, 0..$30. $CC49 increments it per ; byte, $CC7B/$CCC3 reset it, and the guards at $CBFD/$CC2E ; spin while it equals $30 (buffer full). ; vram_slot_idx $ED descriptor slot being filled (stride 4), set at $CC12/$CC8A. ; vram_slot_len $D0 per-slot byte count ) ; vram_slot_ofs $D1 buffer offset for the slot ) four-byte descriptor at $D0+slot, ; vram_slot_addr_lo $D2 VRAM destination low ) consumed by the drain at $CC91 ; vram_slot_addr_hi $D3 VRAM destination high ) (PPUADDR hi then lo, then copy). ; ; VRAM read-back ($CCBA-$CCE5, $F7A7) ; vram_read_len $E8 transfer length; nonzero while a read is pending, and the ; busy flag the callers spin on at $F7BC. ; vram_read_addr_lo $E9 PPU source address, written to PPUADDR second (low byte). ; vram_read_addr_hi $EA PPU source address, written to PPUADDR first (high byte). ; vram_read_dst_lo $EB destination pointer for the copied bytes ($0420 in $F7A7). ; vram_read_dst_hi $EC ; ; PPU helpers ; nt_base_hi $F2 screen/nametable base address, $2000 or $2440 depending on ; nt_base_lo $F3 the select tested at $CA77; added to row offsets at ; $CB19/$CD4B and used to fetch tiles at $CD94/$CD9D/$CDAC. ; ppu_addr_save_lo $F4 running PPU write address, captured from ppu_addr_lo/hi when ; ppu_addr_save_hi $F5 a slot opens ($CC20/$CC24) and copied into the descriptor at ; $CC3A/$CC3E; advanced by the $CB61 counter. ; ; Left neutral on purpose - role not provable from static context: ; * $10-$37, $61, $7F, $A5 (the $E3xx-$E98x ; and $EFxx-$FBxx engines): scratch operands of the collision/scoring/entity maths. ; They are written and consumed inside single routines and reused across routines, ; so any behavioural name would be a guess. Examples: $2C/$2D hold a computed pair ; only between $E3C1 and $E43B; $16/$17 serves as a push/rts jump vector at $F193 yet ; is compared as a 16-bit value at $F29D. ; * $02-$0F, $5F, $6E, $6F, $70, $74, $09: layout/name-table bytes and further ; single-routine temporaries with no repeating, self-describing pattern. ; ; Named in Pass 3 by the table audit: $85-$8F and $92 are not general scratch. They ; are slots of the $0080-$009F palette shadow that FlushPaletteToPpu sends to $3F00-$3F1F ; every NMI - $85/$86/$87 come from the title colour cycle, $8B/$8F/$92 from the three ; aiming-display colour sequences at $F762/$F76A/$F772. See palette_shadow above. ; ; Removed by the Pass 3 reclassification (the aliases are gone from the list above). ; These ten addresses had NO real reference: every one of them was produced by the ; flat tracer decoding data as code, and the bytes it "operated on" are the characters ; of the inline text strings and the values of the lookup tables. ; * $49, $84, $8A, $AA, $C0: the 16-bit pointer table at $C0C0-$C0E5, decoded as a ; `cmp (ZpXX,x)` chain. $C0C0-$C0E5 is now .byte and $C0E6 resumes as `tax`. ; * $3B, $65, $67, $72: ASCII ";" "e" "g" "r" read as operands inside the $F7xx and ; $EBxx text/table data ($F85C ror Zp65, $F85A adc Zp72, ...). ; * $81: the string delimiter $81 of "$81player$81$00", read as `sta (Zp81,x)`. ; ; Existing Pass 1/2 names this audit found imprecise. Not renamed again (to avoid ; churn), recorded here instead: ; * timer_lo/timer_hi ($00/$01): not a 16-bit counter pair in practice. The counter ; routines at $CB39-$CB61 are generic - their stubs pick the target with X = ; $F8/$FA/$FC/$FE, so index 0 is never a target. $00 is a frame/sub-phase counter ; tested with and #$01/#$04/#$08/#$10; $01 is a status/flag byte (and #$7F/#$90/#$F7, ; ora #$08/#$20/#$30). ; * ppu_addr_temp_lo/hi ($F6/$F7): a general 16-bit accumulator used by the ; $FD8B-$FDE6 shift/add multiply and many address builders, not a PPU address. ; * obj_ptr_lo/hi ($6B/$6C): a scratch 16-bit pointer (also used at $C22F/$C3DA), not ; exclusively an object pointer.