The Legend of Zelda/RAM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a RAM map for The Legend of Zelda.

Zero Page

Address     Function                    Details
----------- --------------------------- -----------------------------------------
00          Multiple Functions          X-coords of sprite, ...     
01          Multiple Functions          Y-coords of sprite, ...     
02          Multiple Functions          Tile # for sprite (left half), ...  
03          Multiple Functions          Tile # for sprite (right half), ...     
04          Multiple Functions          Attributes for sprite (left half), ...  
05          Multiple Functions          Attributes for sprite (right half), ...     
06           ?          
07-0F        ?          
08                                      
10          Current Level               (0 = overworld)
11           ?          
12          Game Mode                   0=Title/transitory    1=Selection Screen
                                        5=Normal              6=Preparing Scroll
                                        7=Scrolling           4=Finishing Scroll;
                                        E=Registration        F=Elimination 
13           ?          
14           ?          
15          Frame counter       
16          Current save slot           $00=first, $01=second, $02=third; On selection/registration/elimination screens: $03=fourth option, $04=fifth option
17-28        ?          
29          Timer                       Used for dialog text
2A-4B        ?          
4C          Countdown until Link can use his sword again after touching a White Bubble  
4D-65        ?  
66          ROM Offset for start of current Song Data (low byte)    
67          ROM Offset for start of current Song Data (high byte)   
68           ?  
69           ?  
6A          Pulse-2 Channel Frequency Offset    
6B          Pulse-1 Channel Frequency Offset    
6C          Offset related to Music Pointers    
6D           ?  
6E          Rhythmic Offset             For current note of Pulse 2 Incidental Music
6F          Rhythmic Countdown          For Pulse 2 incidental music (uses value at $6E)
70          Link's screen X             X Position on screen
71          Enemy 1 X-position          Also used for dropped enemy item
72          Enemy 2 X-position          Also used for dropped enemy item
73          Enemy 3 X-position          Also used for dropped enemy item
74          Enemy 4 X-position          Also used for dropped enemy item
75          Enemy 5 X-position          Also used for dropped enemy item
76          Enemy 6 X-position          Also used for dropped enemy item
77          Enemy 7 X-position          Also used for dropped enemy item
78          Enemy 8 X-position          Also used for dropped enemy item
79          Projectile X-position   
7A          Projectile X-position   
7B          Projectile #1's X-position  
7C           ?  
7D           ?  
7E          Link's Sword X-position     
7F          Boomerang/Bait X-position   
80           ?  
81           ?  
82          Link's Arrow X-position     
83           ?  
84          Link's Y-position on the screen     
85          Enemy 1 Y-position          Also used for dropped enemy item
86          Enemy 2 Y-position          Also used for dropped enemy item
87          Enemy 3 Y-position          Also used for dropped enemy item
88          Enemy 4 Y-position          Also used for dropped enemy item
89          Enemy 5 Y-position          Also used for dropped enemy item
8A          Enemy 6 Y-position          Also used for dropped enemy item
8B          Enemy 7 Y-position          Also used for dropped enemy item
8C          Enemy 8 Y-position          Also used for dropped enemy item
8D          Projectile Y-position   
8E          Projectile Y-position   
8F          Projectile #1's Y-position  
90           ?  
91           ?  
92          Link's Sword Y-position     
93          Boomerang/Bait Y Position   
94           ?  
95           ?  
96          Link's Arrow Y-position     
97          Dungeon Floor Item  
98          Links direction             $08=North, $04=South, $01=East, $02=West
99-AA        ?  
AB          Type of item in screen  The value indicates item type (bomb, heart, rupee, etc)
AC           ?  
AD          Type of dropped enemy item #1 
AE          Type of dropped enemy item #2 
AF          Type of dropped enemy item #3 
B0          Type of dropped enemy item #4 
B1          Type of dropped enemy item #5 
B2          Type of dropped enemy item #6 
B3          Type of dropped enemy item #7 
B4          Type of dropped enemy item #8 
B5          Projectile Onscreen?    
B6          Projectile Onscreen?    
B7          Projectile Onscreen?    
B8-C1        ?  
C2          Dropped Enemy Item  
C3          Dropped Enemy Item  
C4-DF        ?  
E0          Game Paused?                $00=No, $01=Yes
E1-E7        ?          
E8          Screen Scrolling?           $00=No, $08=Northbound, $04=Southbound, $01=Eastbound, $02=Westbound
E9           ?          
EA           ?          
EB          Map location                Value equals map x location + 0x10 * map y location
EC-F7        ?  
F8          Player 1 Buttons            (Last Frame)   R = 1, L = 2, D = 4, U = 8, Start = 10, Select = 20, B = 40, A = 80
F9          Player 2 Buttons            (Last Frame)   (See above)
FA          Player 1 Buttons            Pressed    $08=Up, $04=Down, $01=Right, $02=Left $80=A, $40=B, $20=Select, $10=Start 
FB          Player 2 Buttons            Pressed    (See above)
FC          Subscreen Y-scroll position Used for storyboard text and subscreen position
FD          Subscreen X-scroll position This is always zero when not scrolling.
FE           ?  
FF           ?

RAM

RAM     Function                    Details
------- --------------------------- -----------------------
04CD    Screen options              The entry from ROM:0x18680 for the current room     Overworld: stair placement, quest secrets, Link's V placement, monster entry
0513    Candle used                 Whether Link has used the candle on the current screen  $00=No, $01=Yes
0526    Cave return screen          Overworld room to return to when exiting the underworld     
052E    Sword disable               Red Bubble Sword Disable switch: $01 if Link's use of his sword has been disabled by a red bubble, $00 otherwise.
052F    Maze counter                Used for screens 0x61 (forest maze) and 0x1B (mountain room south of level 5)    
05F0                                Related to current frequency being played by Triangle channel   
05F1    Triangle Reverb             Reverb on/off status for Triangle on current song   
05F4    Rhythm table pointer        for current song   
0600    Song Trigger                Song ID#'s are written here to activate; value is copied over to $609 within a frame. $600 is then zeroed-out.
0602    Pulse 2 I.M. Trigger        Incidental Music ID#'s for Pulse 2 are written here; value is copied over to $607 within a frame. 
0604    Pulse 1 I.M. Trigger        Incidental Music ID#'s for Pulse 1 are written here; value is copied over to $605 within a frame.
0605    Pulse 1 I.M. Type           $80=?, $40=1 Heart Warning, $20=Set Bomb, $10=Small Heart Pickup, $08=Key Pickup, $04=Magic Cast, $02=Boomerang Stun, $01=Arrow Deflected            
0606    Sound Effects   
0607    Pulse 2 I.M. Type           $80=Death Spiral, $40=Continue Screen, $20=Enemy Burst, $10=Whistle, $08=Bomb Pickup, $04=Secret Revealed, $02=Key Appears, $01=Rupee Pickup
0609    Songtype currently active   $80=Title, $40=Dungeon, $20=Level 9, $10=Ending, $08=Item, $04=Triforce, $02=Ganon, $01=Overworld
060A    Pulse 2 pos                 Current position within Pulse 2 part (with respect to overall music program)    
060B    Pulse 1 pos                 Current position within Pulse 1 part (with respect to overall music program)    
060C    Triangle pos                Current position within Triangle part (with respect to overall music program)   
060D    Noise pos                   Current position within Noise part (with respect to overall music program)  
060E     ?  
060F    Pulse 1 cycle               Current cycle duration for notes played on Pulse 1 channel  Uses value from rhythm lookup table
0610    Pulse 2 cycle               Current cycle duration for notes played on Pulse 2 channel  Uses value from rhythm lookup table
0611    Pulse 2 rhythm              Countdown from Pulse 2's current rhythm offset  Uses value from rhythm lookup table
0612    Pulse 2 countdown           volume fade  
0613    Pulse 1 rhythem             Countdown from Pulse 1's current rhythm offset  Uses value from rhythm lookup table
0614    Pulse 1 countdown           volume fade  
0615    Triangle cycle              Current cycle duration for notes played on Triangle channel     Uses value from rhythm lookup table
0616    Note countdown              Countdown from value in $615 until next note is to be played    
0617     ?  
0618    Pulse 2 I.M. offset         Offset into Pulse 2 Incidental Music data 
0619    Pulse reverb                Reverb on/off status for BOTH Pulse channels on current song    $80=on, $01=off
061A     ?  
061B    Pulse 2 rhythm counter      Countup to Pulse 2 rhythm offset    
061C    Pulse 1 rhythm counter      Countup to Pulse 1 rhythm offset    
061D                                ??? (seems to count upward as $616 counts down)    Value is always [$615] - [$616] + 1.
061E    Triangle repeat counter     Number of repeats remaining if in Triangle repeat cycle     
061F    Triangle Song pos           Position within song program of current Triangle repeat coda (return point)     
0620    Screen history write index  Contains the index of the next screen history slot to write to (see below)
0621    Screen history 1            One of five recently visited map locations
0622    Screen history 2            One of five recently visited map locations
0623    Screen history 3            One of five recently visited map locations
0624    Screen history 4            One of five recently visited map locations
0625    Screen history 5            One of five recently visited map locations
0626     ?  
0627    Killed enemy count          Number of killed enemies in current screen
0628    Unused  
0629    Unused  
062A    Unused  
062B    Unused  
062C    Unused  
062D    Current quest               save slot 1: $00=First, $01=Second
062E    Current quest               save slot 2: $00=First, $01=Second
062F    Current quest               save slot 3: $00=First, $01=Second
0630    Number of deaths            save slot 1   
0631    Number of deaths            save slot 2   
0632    Number of deaths            save slot 3   
0656    Selected item pos           Cursor position for selecting Link's B item     
0657    Current sword               $00=None, $01=Sword, $02=White Sword, $03=Magical Sword
0658    Number of Bombs     
0659    Arrow status                $00=None, $01=Arrow, $02=Silver Arrow
065A    Bow in Inventory            $00=False, $01=True
065B    Status of candle            $00=None, $01=Blue Candle, $02=Red Candle
065C    Whistle in Inventory        $00=False, $01=True
065D    Food in Inventory           $00=False, $01=True
065E    Potion in Inventory         $00=None/Letter, $01=Life Potion, $02=2nd Potion
065F    Magical Rod in Inventory    $00=False, $01=True
0660    Raft in Inventory           $00=False, $01=True
0661    Magic Book in Inventory     $00=False, $01=True
0662    Ring in Inventory           $00-None, $01-Blue Ring, $02-Red Ring. Note: Changing this value will not change Link's color.
0663    Step Ladder in Inventory    $00=False, $01=True
0664    Magical Key in Inventory    $00=False, $01=True
0665    Power Bracelet in Invenotry $00=False, $01=True
0666    Letter in Inventory         $00=False, $01=True, Link can buy potions from the old woman if $02.
0667    Compass in Inventory        One bit per level
0668    Map in Inventory            One bit per level
0669    Compass in Inventory        (Level 9)
066A    Map in Inventory            (Level 9)
066C    Clock possessed             $00=False, $01=True
066D    Number of Rupees
066E    Number of Keys
066F    Heart Containers            Low Nibble = how many hearts are filled. High Nybble = Number of heart containers - 1
                                    Ex: $10 = 2 Heart Containers with none filled
0670    Partial heart               $00 = empty, $01 to $7F = half full, $80 to $FF = full.
0671    Triforce pieces             One bit per piece
0674    Boomerang in Inventory      $00=False, $01=True. Note: 0x0675 overrides this variable.
0675    Magical Boomerang in Inventory  
                                    $00=False, $01=True.
0676    Magic Shield in Inventory   $00=False, $01=True.
067C    Maximum number of bombs     Starts out as $08.
067D    Number of rupees to add     
067E    Number of rupees to subtract    

WRAM

RAM     Function                    Details
------- --------------------------- -----------------------
6804    Link's tunic color          $29 = green, $32 = blue, $16 = red
6B92    Link's tunic color          Overwritten with 0x6804 when Link exits a cave or enters or exits a level
A014    Name table drawing macro offset     
                                    Pointer to a macro that writes name table data to PPU memory