data/claims/the-legend-of-zelda.yamlThe Legend of Zelda (PRG0 ROM and aldonunez's disassembly)
Game: The Legend of Zelda.
On every pass of its frame interrupt, The Legend of Zelda shifts a 13-byte random register right by one bit, feeding in the exclusive-or of one bit from each of its first two bytes; the step takes nothing from the controller. the-legend-of-zelda/prg0-rng-shift-register
About: The Legend of Zelda Random number generator
CodeLegend of Zelda, The (USA) ·0x1E552-0x1E56B — bank 7 $E542-$E55B: thirteen RORs from $18, carry set by bit 1 of $18 XOR bit 1 of $19zelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_07.asm#L514-L531 — the same step in the source@ScrambleRandom:
LDX #$18 ; Scramble the random array.
LDY #$0D
LDA $00, X
AND #$02
STA $00
LDA $01, X
AND #$02
EOR $00
CLC
BEQ @LoopRandom
SEC
…Checked by claude-agent, 2026-11-30 — read the ROM bytes and the source lines, and followed the interrupt handler's branches to confirm each path reaches the stepChecked by a second AI model, 2026-11-30.Cited by: The Legend of Zelda
While The Legend of Zelda is paused or in its item submenu, the object timers stop counting down but the random register still steps on every pass of the frame interrupt. the-legend-of-zelda/pause-keeps-rolling
About: The Legend of Zelda Pause
CodeLegend of Zelda, The (USA) ·0x1E528-0x1E54A — bank 7 $E518-$E53A: MenuState ($E1) OR Paused ($E0) nonzero branches past the timer loopLegend of Zelda, The (USA) · 0x1E552-0x1E56B — bank 7 $E542-$E55B: the register step, reached on both pathszelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_07.asm#L481-L531 — UpdateTimers through the register loop@UpdateTimers:
; If paused or in menu, then don't decrement timers.
LDA MenuState
ORA Paused
BNE @CheckInput
LDX #$26 ; Advance the stun cycle.
LDA #$3C
LDY #$4E
STX $00
DEC $00, X
BPL @DecTimers
LDA #$09
…Checked by claude-agent, 2026-11-30 — read the branch around the timer loop and followed both paths to the register stepRevised after a check by a second AI model, 2026-11-30: The register steps on every pass of the frame interrupt.Cited by: The Legend of Zelda
While hearts are refilling, The Legend of Zelda adds 6/256 of a heart per update, so one empty heart takes 43 updates to fill. the-legend-of-zelda/heart-fill-rate
About: The Legend of Zelda Hit points
CodeLegend of Zelda, The (USA) ·0x171F6-0x17227 — bank 5 $B1E6-$B217: adds 6 to $0670 while it is below $F8; the next call completes the heart (42 additions, then 1 call)zelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_05.asm#L6763-L6795 — World_FillHeartsWorld_FillHearts:
LDA World_IsFillingHearts
BEQ @Exit ; If not filling hearts, then return.
LDA #$10 ; Play the "heart taken" tune.
STA Tune0Request
LDA HeartPartial
CMP #$F8
BCS @CompleteHeart ; If HeartPartial >= $F8, go complete a heart.
CLC ; else add 6.
ADC #$06
STA HeartPartial
RTS
…zelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_07.asm#L2069-L2073 — UpdateHeartsAndRupees calls it onceUpdateHeartsAndRupees:
LDA #$05
JSR SwitchBank
JSR World_FillHearts
JMP World_ChangeRupeesChecked by claude-agent, 2026-11-30 — read the routine and its caller, and counted the calls from a partial heart of zeroChecked by a second AI model, 2026-11-30.Cited by: The Legend of Zelda
Once the hungry Goriya notices food Link has placed, it waits on a short timer and then removes the food from the room and from Link's inventory, and the Goriya is gone too. the-legend-of-zelda/hungry-goriya-takes-bait
About: The Legend of Zelda Enemy AI
CodeLegend of Zelda, The (USA) ·0x4C8C-0x4CA8 — bank 1 $8C7C-$8C98: food in object slot $F starts the sequence and sets the timer at $29 to $40Legend of Zelda, The (USA) · 0x4CA9-0x4CBD — bank 1 $8C99-$8CAD: at timer zero, clears the food object, InvFood ($065D), Link's state, and this object's typezelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_01.asm#L1508-L1554 — UpdateGrumble1 through UpdateGrumble3UpdateGrumble1:
; If there's no food in object slot $F, then return.
LDY #$0F
LDA a:ObjState, Y
ASL
BCC InitUnderworldPerson_DoNothing
; Else halt Link and play the "secret found" tune.
LDA #$40
STA ObjState
LDA #$04
STA Tune1Request
L_Person_FlagItemTakenAndAdvanceState:
…Checked by claude-agent, 2026-11-30 — read both states in the ROM and the source, including the jump table order in the sourceChecked by a second AI model, 2026-11-30.Cited by: The Legend of Zelda
The Legend of Zelda's start-up code, run at power-on and at reset, clears low memory and then sets the first byte of the random register to 64, so every start begins the register from the same state. the-legend-of-zelda/random-seed-at-power-on
About: The Legend of Zelda Random number generator
CodeLegend of Zelda, The (USA) ·0x17509-0x17519 — bank 5 $B4F9-$B509: clears $00-$EF, then stores $40 in $18 (Random)zelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_05.asm#L7440-L7460 — ClearRamClearRam:
LDA #$07
LDY #$FE ; It doesn't touch [$07FF].
JSR ClearRam0300UpTo
LDA #$00 ; Clear a few individual variables that are left.
STA ReturnToBank4
STA TransferredCommonPatterns
STA TransferredDemoPatterns
STA _Unknown_F3
LDY #$EF
:
STA $0000, Y ; Clear RAM from 0 to $EF.
…zelda1-disassembly: A complete disassembly of The Legend of Zelda · src/Z_07.asm#L348-L354 — RunGame calls ClearRamRunGame:
LDA #$00
STA InitializedGame
LDA #$05
JSR SwitchBank
JSR InitSaveRam
JSR ClearRamChecked by claude-agent, 2026-11-30 — read the clear loop and seed store, the call from the reset path, and searched the source for other writes to RandomChecked by a second AI model, 2026-11-30.Cited by: The Legend of Zelda