Memory Addresses

Memory addresses less than 0x100 tend to be used for temporary or scratch calculations.
AddressTypeNotes
0x03B4u16RNG State
0x0480u16Camera X Coord
0x0482u16Camera Y Coord
0x048Eu8Room ID Number
0x0490u8HP Regen Counter
0x0491u8MP Regen Counter
0x0492u16Room Max Allowed X Coordinate
0x0494u16Room Max Allowed Y Coordinate
0x04E0Story FlagsStory Flags (Bosses)
0x04E1Story FlagsStory Flags (Followers and Ella)
0x04E2Story FlagsStory Flag (General #1)
0x04E3Story FlagsStory Flag (General #2)
0x04E4Story FlagsStory Flag (General #3)
0x04E5Story FlagsStory Flag (General #4)
0x04E6Story FlagsStory Flag (General #5)
0x0500Sprite DataNasir's Data
0x0540-0x0D3FSprite DataNPC and Enemy Data

Story Flags

Each of 0x04E0-0x04E6 are bitfields which represent current Story Progress.
AddressMaskPurpose
0x04E00x01Thor Bird Defeated
0x04E00x02Green Evil Spirit Defeated
0x04E00x04Battler Defeated
0x04E00x08Thimale Defeated
0x04E00x10Duma Defeated
0x04E00x20Eardon Defeated
0x04E00x40Natela Defeated
0x04E00x80Samson Defeated
0x04E10x01Giles is Following
0x04E10x02Thor is Following
0x04E10x04Unused?
0x04E10x08Unused?
0x04E10x10Unused?
0x04E10x20Unused?
0x04E10x40Unused?
0x04E10x80Ella Defeated
0x04E20x01Voloh - Speak with Elf at Entrance
0x04E20x02Atland - Speak with Mayor in House (put these on)
0x04E20x04Atland - Speak with Chaplain after scene (Go talk to Mayor in his house)
0x04E20x08Atland - Speak with Mayor's Wife in House (Mayor's at Worship Site)
0x04E20x10Phantom Hill - Watch Wizard Fight
0x04E20x20Atland - Speak with Mayor in Chapel (triggers scene)
0x04E20x40Voloh - Thor Escort Finished
0x04E20x80Atland - Giles Escord Finished
0x04E30x01Poper - Speak with Basement Sage #6
0x04E30x02Poper - Speak with Basement Sage #5
0x04E30x04Poper - Speak with Basement Sage #4
0x04E30x08Poper - Speak with Basement Sage #3
0x04E30x10Poper - Speak with Basement Sage #2
0x04E30x20Poper - Speak with Basement Sage #1
0x04E30x40Poper - Speak with Chaplain to unlock Basement
0x04E30x80Phantom Hill - Speak with Zerah after Wizard Fight
0x04E40x01Atland - Speak with Injured Man
0x04E40x02Phillips Castle - Teleport Elves in Jail
0x04E40x04Denegul - Speak with Thor to start fetch quest
0x04E40x08Siegfried Castle - Watch Lagoon Castle Cutscene
0x04E40x10Poper - Sick Kid Scene
0x04E40x20Poper - Speak with Final Basement Sage
0x04E40x40Dwarf Cave - Ella/Princess Cutscene
0x04E40x80Lagoon Castle - Rescue Princess
0x04E50x01Phillips Castle - Unlocked Entrance
0x04E50x02Siegfried Castle - Unlock Upstairs
0x04E50x04Siegfried Castle - Unlock Boss Door
0x04E50x08Phillips Castle - Unlocked Basement Prison Door
0x04E50x10Philips Castle - Unlocked Roof
0x04E50x20Gold Cave - Unlock Boss Door
0x04E50x40Denegul - Thor Fetch Quest turned in
0x04E50x80Atland - Speak with Mayor outside of Gold Cave
0x04E60x01Eardon - Boss text seen
0x04E60x02Unused?
0x04E60x04Unused?
0x04E60x08Lagoon Castle - Talk to Princess?
0x04E60x10Unused?
0x04E60x20Unused?
0x04E60x40Elf Field - Thor is walking to Tablet
0x04E60x80Elf Field - Thor gives you tablet

Sprite Data

Sprite data is stored in more or less the same sort of structure between Nasir and NPCs and Enemies and so on. It's a 0x40 length record.
OffsetTypeNotes
0x00BitfieldContains information about the status of a sprite
0x02u16X Coordinate
0x04u16Y Coordinate
0x06u16X Movement (How much in the X direction is the sprite moving under its own power (if moving up and down, does not count ejections to the left and right))
0x08u16Y Movement (See above)
0x0Au8Facing direction
0x0Bu8Direction move attempted in
0x0Cu16X Coordinate relative to Camera
0x0Eu16Y Coordinate relative to Camera
0x10u8Walking animation counter (counts up to a certain point)
0x11u8Walking animation frame (changes the frame of animation once the above counter resets)
0x12u8Stun Counter
0x13BitfieldStun bits (still needs investigation, 1 when damaged, 2 when pushed by shield)
0x14Fixed point 16 bitsNasir Jump Displacement (Z displacement, low byte in subpixels, high byte in pixels)
0x16Fixed point 16 bitsNasir Jump Velocity (Same layout)
0x18u8Sprite Type (see enum)
0x19u8Movement Direction Result
0x1Au8Unused by Nasir, used by NPC/Enemy update subroutines, Unknown
0x1Bu8Sprite ID, determines which NPC/Enemy it is
0x1Cu8Current Hitbox ID
0x1Du8Nasir Sword Animation Frame
0x1Eu8Nasir Shield Animation Frame
0x1Fu8Nasir Jump Animation Frame
0x20u16Current HP (some enemies have more than 255 HP)
0x22u16Current MP
0x24u16Attack
0x26u16Defense
0x28u16Gold (for enemies, this is the amount they give you)
0x2Au16Exp (for enemies, this is the amount they give you)
0x2Cu8Level (for enemies, this controls different forms, for instance, Samson's Helmet)
0x2Du8Unknown (Unused by Nasir, only read by part of the sprite update code.)
0x2Eu8Unknown (ibid)
0x2Fu8Magic Projectile Active
0x30u16Respawn Position X (Enemies)
0x30u8Equipped Sword ID (Nasir)
0x31u8Equipped Armor ID (Nasir)
0x32u16Respawn Position Y (Enemies)
0x32u8Equipped Shield ID (Nasir)
0x33u8Equipped Ring ID (Nasir)
0x34u8Equipped Magic Staff ID
0x35u8Equipped Magic Crystal ID
0x36u8Equipped Item ID
0x37u8Equipped Magic ID Staff << 2) + Crystal)
0x3Eu8Command (the direction you told Nasir to go?)
0x34-0x3Fu8/u16Enemy data used in AI Routines, unless noted, not used by Nasir.

Enums

Sprite Types

IDType
0Player
1Friendly NPC
2Enemy
3Boss
4Unknown/Unused
5Door

Directions

IDDescription
0Right
1Down
2Left
3Up
-1No Direction

Command

BitmaskDescription
0x0000None
0x0020Use Item
0x0080Jump
0x0100Go Right
0x0200Go Left
0x0400Go Down
0x0800Go Up
0x1000Pause
0x4000Open Chest
0x8000Use Sword

Item IDs

Only some key items listed, work in progress.
IDDescription
0x26Samson's Key
0x27Key of Phillips
0x28Key of Prison
0x29Mint
0x2ADuma's Key
0x2BKey of Siegfried
0x2CMovable Mantle
0x2EFreezing Pot
0x2FThor's Pendant
0x30Powerful Mirror
0x31Moon Stone
0x32Angel's Bell
0x33Truth Fire
0x34Fur Mantle
0x35Statue

Enemy IDs

Resistances are listed in the form of 4 numbers, 0-F, which is a bitmask that determines which spells effect the enemy. Level 1 spells check the first bit, level 2 check the second and so on. So if an enemy has a 0, then no spells affect it, if the enemy has an F then all spells affect it, E then spells Level 2 or higher affect it, C level 3 or higher. The order is given by Lightning, Water, Wind, Fire. So FC0E is fully vulnerable to jLightning and will take damage from level 2 or better Fire spells, vulnerable to level 3 or better Water Spells, and completely immune from Wind spells.
NameLocationIDHPAtkDefGoldExpResistances
CrilGold Mine014201532FFFF
DroGold Mine112151021F0FF
ChiphonGold Mine2243026430000
TickElf Field344283034FFFF
BuneElf Field412354035FFFF
SavagePhilips Castle550453856FF0F
GregoryPhilips Castle660402555EEEE
ReviePhilips Castle754502054F0FF
RoputoPhilips Castle860554236FFFF
CrudPhilips Castle96860056000F
HauruPhilips Castle1064654557FFFF
RockDwarf Field1174901061010F0F0
Hunter WolfDwarf Field1274849859FFFF
MagieDwarf Cave135896010320FF0
BizarlDwarf Cave141001021221020FFF0
NondiettoHobbit Valley15110108130630FFFF
ZudabvouHobbit Valley1694114138522FFFF
GustavuSiegfried Castle17120157184730CCCC
ElumerutergieSiegfried Castle1844150175135FFF0
MikkySiegfried Castle19144165194740FFFF
AngelassuSiegfried Castle20130172204852FFFF
RevockSiegfried Castle21110180213860FFFF
KiezerSiegfried Castle22134187223980CCCC
HellionesIce Cave231441952321080F0FF
OrutonPhantom Hill24150210252590FFFF
SagiterlLagoon Castle251842473007200FF0F
NuterIce Cave261002022422120F0FF
D ClineLagoon Castle271702402907160FFFF
Killerknight DameLagoon Castle2819025530982500000
EdogerLagoon Castle292102623897300F00F
SadowieeSecret Place302002773385350F0FF
FlyokutoLagoon Castle311602172617130FFFF
BrolLagoon Castle321742252715140FFFF
FoolisharukanLagoon Castle331442322807150FFFF
BishamonLagoon Castle3425527032883500000
ExellianSecret Place35230285348104000000
Thimale GuardianIce Cave Boss Room364022522600F00F
Evil Spirit ShellSecret Place Boss Room #1371280307264000000
Beast ZerahSecret Place Boss Room #238500285384000000

Boss IDs

NameIDHPAttackDefGoldExp
Samson096246510064
Natela11005598500250
Eardon21501302662800500
Doma3240140210300800
Doma Hand #14024021000
Doma Hand #25024021000
Thimale625615022610001500
Battler725619555810003000
Battler Egg #18029529800
Battler Egg #29029529800
Green Evil Spirit1025631245400
Thor1125620521400
Thor Bird1225635555000
Thor Orbs13020531400
Ella1425620548210002000
Red Evil Spirit1525631256000

Rooms

Room ID (hex)Room ID (dec)Description
00Atland
11WorshipSite
22GoldCaveEntrance
33GoldCaveB1
44GoldCaveHallway1
55GoldCaveB2
66GoldCaveHallway2
77GoldCaveOutdoors
88ElfField
99Voloh
$A10PhillipsCastleEntrance
$B11PhillipsCastle1F
$C12PhillipsCastle2F
$D13PhillipsCastleBasement
$E14PhillipsCastleWarp
$F15DwarfDesertWarp
$1016DwarfDesert
$1117Denegul
$1218DwarfCaveCorridor1
$1319DwarfCaveCorridor2
$1420DwarfCave1
$1521DwarfCave2
$1622SilentTerrence
$1723DwarfCaveFoyer
$1824HobbitValley
$1925Poper
$1A26PoperHouse
$1B27PoperChurch
$1C28PoperChurchBasement
$1D29SiegfriedCastleEntrance
$1E30SiegfriedCastle1F
$1F31SiegfriedCastle1FStairs
$2032SiegfriedCastle2F
$2133SiegfriedCastle3F
$2234SiegfriedCastleBasement
$2335GnomeTree
$2436Lilaty
$2537GnomePlain
$2638IceCave
$2739NymphSpring
$2840PhantomHill
$2941PhantomHillSummit
$2A42Clouds
$2B43LagoonCastleEntrance
$2C44LagoonCastle1F
$2D45LagoonCastle1F_Hallway1
$2E46LagoonCastle1F_Hallway2
$2F47LagoonCastle2F
$3048LagoonCastle2F_Hallway1
$3149LagoonCastle2F_Hallway2
$3250LagoonCastle3F
$3351LagoonCastle3F_Hallway1
$3452LagoonCastle3F_Hallway2
$3553LagoonCastle4F
$3654LagoonCastle4F_Hallway1
$3755LagoonCastle4F_Hallway2
$3856LagoonCastle5F
$3957LagoonCastle5F_Hallway1
$3A58LagoonCastle5F_Hallway2
$3B59LagoonCastleDock
$3C60SecretPlaceEntrance
$3D61SecretPlaceCottage
$3E62SecretPlace
$3F63Unused
$4064SamsonsRoom
$4165NatelaRoom
$4266EardonsRoom
$4367DumasRoom
$4468ThimalesRoom
$4569BattlersRoom
$4670EvilSpiritsRoom1
$4771EvilSpiritsRoom2
$4872EllasRoom
$4973KingAndQueensChamber
$4A74FeliciasChamber

Other Info

Room Sprite Data

Room Sprite Data is located at ROM address 0x859552, in a packed array of 0xFFFF terminated lists. Each entry is formatted as this structure
OffsetTypeDescription
0x00u8Sprite Type
0x01u8Sprite ID
0x02u16X Coordinate
0x04u16Y Coordinate
0x06u8Initial Direction
0x07u8Initial Status
0x08u8Initial Animation?
It is referenced by a mostly unexplored Room Metadata struct, that has the 24-bit pointer at offset 0x2B. Room Metadata is stored in the ROM at 0x85B2DF, and each entry is 0x38 bytes long.

RNG

Nasir's attempted movement direction gets mixed in with the RNG at 0x81814B by simply adding it to 0x03B5, giving the player a way of controlling the RNG a little bit. However, these numbers are rather small (-1, 0, 1, 2, 3), additionally, because Manhattan geometry, there are several different equivalent paths to go to a specific point; however, they will all add the same amount overall. The ways to change this are via an delay, and via cutting a corner more or less.
Every time an RNG value is needed 0x809848 ("GetNextRNG") is called.
This function does roughly the following:
acc = $3B5 + 1; $3B4 = acc; $3B5 = 5 * acc; $3B4 = $3B5 * 16 | $3B5 / 16; // nibble swap return $3B4;

Nasir Level Data

LevelHPMPAttackDefenseExperience Required to ReachAdditional Experience Required to reach next level
1103105010
217813101030
3231017164050
4281222199080
536192623170110
643223026280120
754273431400160
863303836560190
968344140750220
1075384743970260
11894653491230300
12965758531530350
131196361571880410
141267665622290520
151428169682810740
161489376753550630
1715311483794180870
1816012389835050950
19169138969060001180
2017414511710171801410
2118015112411085901690
22184157135124102801970
23187162142137122502210
24192171148142144602780
25201179157150172403230
26208185163161204703730
27210192176172242004170
28213199183184283704690
29219213189193330604980
30221219211203380405200
31228227224212432405560
32231236237223488005910
33239240243231547106120
34248245247243608304705
35255255255255655350

GameResources/SNES/Lagoon last edited by OmnipotentEntity on 7/8/2023 6:38 PM
Page History Latest diff List referrers View Source