Zelda II: The Adventure of Link/RAM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a RAM map for Zelda II: The Adventure of Link.

$0012 - frame counter

$0013 - set to 8 and The Player is a fairy, set to 0 and The Player is Link 

$0019 - draw Link's sprite?

$0026 - ?Movement Tally - Increases as you walk in overworld.


$0029 - Player's Current Y position

$002A - Enemy 6's current Y position
$002B - Enemy 5's 
$002C - Enemy 4's 
$002D - Enemy 3's 
$002E - Enemy 2's 
$002F - Enemy 1's 

$0030 - Projectile Y
$0031 - Projectile
$0032 - Projectile
$0033 - Projectile
$0034 - Projectile
$0035 - Projectile

$0036 - Sword Projectile Y On Screen

$003B - Player's current map page

$003C - Enemy 6's current map page
$003D - Enemy 5's 
$003E - Enemy 4's 
$003F - Enemy 3's 
$0040 - Enemy 2's 
$0041 - Enemy 1's 

$0042 - Projectile Map Page
$0043 - Projectile
$0044 - Projectile
$0045 - Projectile
$0046 - Projectile
$0047 - Projectile

$004D - Player's Current X position LSB

$004E - Enemy 6's current X position LSB
$004F - Enemy 5's 
$0050 - Enemy 4's 
$0051 - Enemy 3's 
$0052 - Enemy 2's 
$0053 - Enemy 1's 

$0054 - Projectile X
$0055 - Projectile
$0056 - Projectile
$0057 - Projectile
$0058 - Projectile
$0059 - Projectile

$005F - side scroll exit side: 2 = exited left, 1 = exited right

$0060 - Enemy 6's current facing direction
$0061 - Enemy 5's 
$0062 - Enemy 4's 
$0063 - Enemy 3's 
$0064 - Enemy 2's 
$0065 - Enemy 1's 

$0066 - Projectile facing direction
$0067 - Projectile
$0068 - Projectile
$0069 - Projectile
$006A - Projectile
$006B - Projectile

$0070 - Link's X speed
$0071 to $0076 Enemy's speed

$0073 - Y position on map (not visually)
$0074 - X position on map (not visually)

$0077 - Projectile speed
$0078 - Projectile
$0079 - Projectile
$007A - Projectile
$007B - Projectile
$007C - Projectile

$0080 - Link's sprite index
    0-3: Walking
    4: Standing wind up
    5: Standing stab
    6: Crouching
    7: Crouching stab
    8: Up stab
    9: Down stab

$0086-0089 -  Overworld random monster type (00 - None, 01 - Small, 02 - Big, )

$0087 - Projectile ID/type
$0088 - Projectile
$0089 - Projectile
$008A - Projectile
$008B - Projectile
$008C - Projectile

$008D - Projectile Flag (00 - Inactive, 01 - Active, F2-FF - Disintegrating)

$009F - Player's Facing Direction (side-scroll)

$00A1 - Enemy 6's ID / type
$00A2 - Enemy 5's 
$00A3 - Enemy 4's 
$00A4 - Enemy 3's 
$00A5 - Enemy 2's 
$00A6 - Enemy 1's 

$00A7 - Solids hit detection bits, 0000dcba, a = left, b = right, c = down, d = up.

$00AF - Enemy 6's current-item-ID OR something else(AI?)
$00B0 - Enemy 5's 
$00B1 - Enemy 4's 
$00B2 - Enemy 3's 
$00B3 - Enemy 2's 
$00B4 - Enemy 1's 
$00B4 - timer for healer lady in shield-town leaves door open

$00B5 
	 2 will make link die in lava
	 3 move right like when win game at dark link

$00B6 - Enemy 6 exists
      - set to 10 will make link fall down 
$00B7 - Enemy 5 
$00B8 - Enemy 4 
$00B9 - Enemy 3 
$00BA - Enemy 2 
$00BB - Enemy 1 

$00BC - Enemy 6's ?sram Y index (LDY BC,X  ; then LDA ($D6),Y   if bit7 is set it means monster killed?)
$00BD - Enemy 5's 
$00BE - Enemy 4's 
$00BF - Enemy 3's 
$00C0 - Enemy 2's 
$00C1 - Enemy 1's 

$00C2 - Enemy 6's HP
$00C3 - Enemy 5's HP
$00C4 - Enemy 4's HP
$00C5 - Enemy 3's HP
$00C6 - Enemy 2's HP
$00C7 - Enemy 1's HP

$00CC - Link's X on screen - 8 ($4d - $72c)

$00CD to $00D3 - Monster X on screen ($4e - $72c)

$00DE - ?set to 1 to prevent moving, 0 to allow??

$00A1 - Enemy 6's ID
$00A2 - Enemy 5's ID
$00A3 - Enemy 4's ID
$00A4 - Enemy 3's ID
$00A5 - Enemy 2's ID
$00A6 - Enemy 1's ID

$00C2 - Current amount of health enemy 6 has
$00C3 - Current amount of health enemy 5 has
$00C4 - Current amount of health enemy 4 has
$00C5 - Current amount of health enemy 3 has
$00C6 - Current amount of health enemy 2 has
$00C7 - Current amount of health enemy 1 has

$00CC - ?Player X On Screen?

$00D1 - maximum number of map pages for this scene

$00E0-EF - Music variables (behaves different for title screen vs. normal game)

Title Screen:
$00EA - Music to play
    1: Title theme
$00EB - Sound effect to play
    $01: Letter entry sound
    $02: Select different letter sound
    $04: Select different menu item sound
    $08: Elimination sound

Normal Game:
$00E9 - DMC sound effect to play?
$00EA - Pause music if non-zero
$00EB - Music track to play. Set of tracks differs based on world ($707).
    World ($707 = 0):
        $01: Overworld
        $02: Overworld Loop
        $04: Battle
        $08: Mutant Battle
        $10: Item Acquired (restart previous music afterward)
    Town ($707 = 1/2):
        $01: Town
        $02: Town Loop
        $04: Mutant House
        $08: House
        $10: Learn Technique (restarts previous)
    Palace ($707 = 3/4):
        $01: Palace
        $02: Palace Loop
        $04: Mutant Palace Loop
        $08: Boss Theme
        $10: Item Acquired
        $20: Silence
        $40: Crystal Placed (does NOT restart previous)
        $80: Silence
    Great Palace and Ending / Zelda Awakens ($707 = 5/6):
        $01: Great Palace
        $02: Great Palace Loop
        $04: Zelda Awakens / Ending (both are used in their different zones but are the same)
        $08: Credits
        $10: Item Acquired
        $20: Game Complete (does NOT restart previous)
        $40: Dark Link Battle
        $80: Silence
$00EC - Complex sound effect to play
    $01: Death (stops music)
$00ED - Triangle/noise sound effect to play
$00EE - Square 2 sound effect to play
    $01: Falling (stops music)
    $02: Enemy Encounter (starts battle music)
    $04: Exiting side-scrolling (stops music)
$00EF - Square 1 sound effect to play

$00F5 - Controller 1 button pressed
$00F6 - Controller 2 button pressed
$00F7 - Controller 1 button held
$00F8 - Controller 2 button held

$00FE - ?changes brightness sorta?

$0100 - NMI handler behavior: ng-- ----
    n: Do gameplay. If clear, only update sound during NMI.
    g: In game. If clear, do title screen NMI handling.

$0100 states:
    $80 at title screen
    $c0 when loading game
    $40 when entering game (after displaying number of lives)
    $c0 in game

$0301 - Used when writing text to screen
$0302 - Used when writing text to screen
$0303 - Letter position when writing to screen
$0304 - Text memory offset?
$0305 - Empty Row Space Character
$0306 - Letter Written to Screen
$0307 - Text memory offset?

$03D6 - Player's X Subpixel
$03D7 - Enemy 6's X Subpixel
$03D8 - Enemy 5's 
$03D9 - Enemy 4's 
$03DA - Enemy 3's 
$03DB - Enemy 2's 
$03DC - Enemy 1's 

$040E - Enemy 6's stun-delay-when-hit timer
$040F - Enemy 5's 
$0410 - Enemy 4's 
$0411 - Enemy 3's 
$0412 - Enemy 2's 
$0413 - Enemy 1's 

$0488 - selection index for MENU (continue/save)

$0489 - Text Column
$048A - Text Row
$048B - Conversation Pointer

$048E - Enemy 6's item-ID in the future
$048F - Enemy 5's 
$0490 - Enemy 4's 
$0491 - Enemy 3's 
$0492 - Enemy 2's 
$0493 - Enemy 1's 

$0500 - Invincibility after stun counter (counts down, nonzero = invincible)

$050A - ?Attack Delays
$0518 - ?Invulnerable Timeout (01-02 - Blinking, 03+ - Not Blinking)

$0524 - menu control / state 

$0561 - Current scene/map index 

$0562 - Player's Facing Direction (overworld map)

$0562 - ?Controller 1 Last Poll

$0563 - Terrain type under Link in overworld
    0: Town
    1: Cave
    2: Palace (includes North Palace)
    3: Bridge/raft tile
    4: Desert
    5: Grass
    6: Forest
    7: Swamp
    8: Graveyard
    9: Road
    a: Lava
    b: Mountain
    c: Impassable water
    d: Passable water
    e: Destructible boulder
    f: River devil

$0564 - ?Magic Points - Display
$0565 - ?Hit Points - Display

$0569 - used for counting text when displaying talk text
$056B - involved with Life Town's Bagu Bridge, when $56B=2 and $796=1 then Bagu Bridge will be built
$056B - Town Code
$056C - Palace index on continent ($748 - #$34)

$057D - Player Y speed

$057E - Enemy 6's stun-delay-when-hit timer
$057F - Enemy 5's 
$0580 - Enemy 4's 
$0581 - Enemy 3's 
$0582 - Enemy 2's 
$0583 - Enemy 1's 

$05CA - Sword Projectile Timeout

$05DF - count of easy monster killed for item drop
$05E0 - count of hard monster killed for item drop

$05EB - Experience an enemy takes away

---------------(Uses bits?)---------------------

$0608 bits
 - Heart Container #2 taken FB (1111 1011)
$0610 bits
 - Trophy taken F7 (1111 0111)
$0613 bits
 - Heart Container #1 (S of Parapa Palace) taken DF (1101 1111)
$0615 bits
 - Exp. Bag (NE of Castle) taken FD (1111 1101)
$0616 bits
 - Magic Container #1 (S of Castle) taken FE (1111 1110)
$0617 bits
 - Exp. Bag  (E of Saria) taken DF (1101 1111)
$061C bits
 - Extra Life (W of Cemetery Palace) taken FD (1111 1101)
$0624 bits
 - Red magic jar (Death MT #1) taken FB (1111 1011)
$0626 bits
 - Red magic jar (Death MT #2) taken F7 (1111 0111)
$0629 bits
 - Red magic jar (Death MT #3) taken DF (1101 1111)
$062A bits
 - Hammer taken FE (1111 1110)
$062D bits
 - Magic Container #2 (Death MT) taken BF (1011 1111)
$0643 bits
 - Heart Container #3 (N of Island Palace) taken FB (1111 1011)
$0657 bits
 - Heart Container #4 (E of Seaside Palace) taken BF (1011 1111)
$0680 bits
 - Parapa Desert Key #2 will appear (FB - yes : FA - no)
$0681 - Parapa Desert Key #1 will appear (FF - yes : F7 - no)

$0684 - bits
 - Candle taken 7F (0111 1111)
 - Parapa Desert Lock to Candle unlocked BF (1011 1111)
 - Bag on top of Elevator down taken DF (1101 1111)
 - Left side of bridge exp. bag taken FB (1111 1011)
 - Right side of bridge exp. bag taken FD (1111 1101)

$0700 - Current number of lives
$0701 - start this side of screen: 0=left, 1=right
$0704 - (Elevator) 0=start bottom of screen, 1=start at top of screen

$0706 - Overworld index
    0: West
    1: Death Mountain / Maze Island
    2: East
$0707 - "World"
    0: Overworld and all other areas not listed
    1: West towns, Bagu's cabin, King's Tomb
    2: East towns
    3: Palaces 1, 2, 5
    4: Palaces 3, 4, 6
    5: Great Palace and ending
    6: Zelda awakens scene

$0709 - involved in returning to the over-world while in side-scroll?
$070A - Overworld index for overworld when in side-scrolling
$070B - Graphics Bank for Palaces

$070C - add this value to link's MP slowly (old lady magic restore)
$070D - add this value to link's HP slowly (healing lady)

$070E - setting to 1 will make link sink (duck into the chimney)

$0728 - setting to 1 will freeze screen, prevent from exiting left/right (like during a boss battle)

$072A - Leftmost pixel of screen X scroll MSB
$072B - Rightmost pixel of screen X scroll MSB
$072C - Leftmost pixel of screen X scroll LSB
$072D - Rightmost pixel of screen X scroll LSB

$0736 - game mode/current state
    side-scroll: set $769,$706,$707,$56B,$56C,$561, and set $736 to 0 (to load any scene anywhere)
		$769	$706	$707	$56B	$56C	$561
rauru		03	00	01	00	F8	
nabooru		03	02	02	04	F8	
palaces 1	04	00	03	04	00	00
palaces 2	04	00	03	04	01	0E
palaces 3	04	00	04	05	02	00
palaces 4	04	01	04	08	00	0F
palaces 5	04	02	03	08	00	23
palaces 6	04	02	04	08	01	24
GP		05	02	05	09	02	00
		
    side-scroll: set $709 to 1, set $736 to 0 (to go outside/return to over-world map)
    side-scroll: set $709 to 1, set $748 and $706 to target destination, set $736 to 0 (to go outside/return to over-world map) (also $707, $70A and $70B may need to be set to 0??)
    ?side-scroll: set $561 to target scene/map index, set $736 to 0,8,C (to load scene)
    Over-world: set $736 to 6 or 0 (enter map position u are at)  
    over-world: set $73 and $74 , then set $736 to 2 (update screen with position)

$0743 - elevator was moving up or down: 8=up, 4=down

$0748 - True area location index. When transitioning to side-scrolling this will temporarily be overworld location index before translation to true area index.

$0749 - Current position of the selector on Magic

$074B - this value causes two different flashing effect of magic

$0755 - add this value to link's exp slowly (add 255 for every value)
$0756 - add this value to link's exp slowly

$075A - Current enemy encounter type in side-scrolling
    0: Either fairy or fixed encounter (overworld location)
    1: Small enemy
    2: Big enemy

$075C - Start this map page

$0768 - ?changes brightness sorta?
$0769 - Bank to switch back to after changing banks in NMI handler
$076C - Game state, can also be written to initiate a special routine
    0: Entering game (restart from North Palace with 3 lives)
    1: In game
    2: Dying (die)
    3: Ending (wake up Zelda)
    4: Credit (roll credits), 
    5: ??
    6: Beginning a life (show the lives then restart the scene)

$076F - A fairy if 08
      - 0=beam projectile only full hp	10=flame projectile
$0770 - Exp. needed for Next Level (add 255 for every value)
$0771 - Exp. needed for Next Level (000 - 255)

$0773 - Current Magic left in meter
$0774 - Current Life left in meter
$0775 - Experience MSB
$0776 - Experience LSB

$0777 - Attack Power
$0778 - Magic Power
$0779 - Life Power

$077B - Have Shield magic
$077C - Have Jump magic
$077D - Have Life magic
$077E - Have Fairy magic
$077F - Have Fire magic
$0780 - Have Reflect magic
$0781 - Have Spell magic
$0782 - Have Thunder magic
$0783 - Current number of Magic Containers
$0784 - Current number of Heart Containers
$0785 - Have Candle
$0786 - Have Glove
$0787 - Have Raft
$0788 - Have Boots
$0789 - Have Flute
$078A - Have Cross
$078B - Have Hammer
$078C - Have Magic Key

$0793 - Current number of keys
$0794 - Number of Crystals left for grand palace
$0796 - Have (Downward Thrust 10) (Upward Thrust 04) (Both 14)
$0798 - Have collected (Trophey B6 - yes) (Medicine 43 - yes)
$0799 - Have collected the Mirror (01 - yes)
$079A - Have collected note from Baju (08 - yes)
$079B - Have collected some water (01 - yes)
$079C - Have collected lost child (20 -yes)
$079F - Number of times died

$07E8 - Noise
$07E9 - Triangle
$07EA - Pulse 2
$07EB - Pulse 1
$07FB - ???MUSIC???

$0FA0 - Player name value #1
$0FA1 - Player name value #2
$0FA2 - Player name value #3
$0FA3 - Player name value #4
$0FA4 - Player name value #5
$0FA5 - Player name value #6
$0FA6 - Player name value #7
$0FA7 - Player name value #8

$6000 to $633F - current sidescroll data
MapPage	RamLocation
0	6000-60CF
1	60D0-619F
2	61A0-626F
3	6270-633F
	95 is a grave tile
	51 is a bridge tile

$6340 to $6957 - unused?
$69E0 to $69FF - unused?

$6A00 - Overworld location table, indexed by $748. The last entry is overworld enemy encounter and dynamically updated.
    6A00-6A3E Byte 0: wyyy yyyy
        w: Area changes world (707 value) and overworld (706 value).
        y: Y coordinate on overworld.
    6A3F-6A7D Byte 1: EExx xxxx
        E: Entrance number of area (0-3). Subtract from table index to get true area number.
        x: X coordinate on overworld.
    6A7E-6ABC Byte 2: ppmm mmmm
        p: Map page number to start at (0-3, 75c value). Even pages enter from the left, odd from right.
        m: Map number (561 value).
    6ABD-6AFB Byte 3: hsrw wwCC
        h: Entrance is a hole to fall into.
        s: Single-tile area that has 2 exit points.
        r: Enters from right regardless of initial map page number.
        w: Area world number (707 value). Ignored unless byte 0 w is set.
        C: Area overworld number (706 value). Ignored unless byte 0 w is set.

$6AFC - table of room connectivity data (6AFE can be P0 right exit )

$6C58 to $6CFF - unused?

$6D27 - HP for Magic Stealing Skulls
$6D41 - HP for Horsehead

$6FA1 to $6FFF - unused?

Save File Data Locations:

    File 1      File 2      File 3
    6002-6033   6034-6065   6066-6097   File part 1 copy (used during saving)
    6098-6177   6178-6257   6258-6337   File part 2 copy (used during saving)
    7400-7401   7498-7499   773a-773b   File header
    7402-7433   7434-7465   7466-7497   File part 1, saves $777-$7a8 ($32 bytes)
    749a-7579   757a-7659   765a-7739   File part 2, saves $600-$6df ($e0 bytes)

Save file header byte 0 values determine how to handle save file at power-on:
    5a: Save was interrupted and main file has most recent valid save. Revert to main file.
    69: File copy has most recent save. Copy file copy to main file and use it.
    a5: Main file has most recent save.
    Anything else: Save file is invalid and must be reinitialized.

---- Save File 1 ----
    
    $7402 ($777) - Attack Level
    $7403 ($778) - Magic Level
    $7404 ($779) - Health Level
    $740E ($783) - Number of Magic Containers
    $740F ($784) - Number of Heart Containers
    $742A ($79F) - Death counter (max 255)
    $742B ($7A0) - 'Second Quest' - nonzero if player has beaten the game on this file (triforce will be shown in menu)
    $742C ($7A1) - Player name (8 chars)

$773C to $77FF - unused?
$79F9 to $7BFF - unused?

$7C00 to $7F7F - RLE compressed overworld map

$7FA6 TO $7FFF - unused?

$DD4C - Beginning of graphics shown for experience (part 1)
$DD5C - Beginning of graphics shown for experience (part 2)
$DDC0 - Beginning of experience gained for enemies