Dragon Warrior Monsters/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Dragon Warrior Monsters.

Bank 00

rst $10

This method is used to call functions stored in other banks. It's usually preceded by writes to RAM locations (which act as arguments to the function being called). The function to call is selected via HL, so the rst $10 call is always directly preceded by a write to HL. In this, H is the bank of the function to call, while L is the index of it.

At the start of every bank, besides bank 0, is a byte indicating the bank itself, followed by a list of 2-byte address which address the cross-bank functions stored in that bank. The index is the index into this table (0-based).

For example, the start of bank 1 looks like this:

01:4000  01     = Bank index
01:4001  1D 40  = Cross-bank function 0's address (call it with mov hl,$0100; rst $10;)
01:4003  D3 4D  = Cross-bank function 1's address
01:4005  1C 42  = Cross-bank function 2's address
      ...
01:401B  E1 69  = Cross-bank function 13's address
01:40D1  ...    = Cross-bank function 0's code

Text functions

00:07AB HandleTextCharacter
00:0D78 ReadNextTextByte

Math functions

00:1dbe Mul8x8To16   HL = A * C
00:1de6 Mul16x8To24  E:HL = BC * A
00:1e0d Div16x8To16  HL = HL // A; A = HL % A
00:1e1e Div24x8To16  HL = E:HL // A; A = E:HL % A
00:2f45 CmpHLvsBC
00:2f4b Div16x16To16 DE = HL // BC; BC = HL % BC

Bank 03

Monster info table

Base info for monsters starts at 03:4461. This table has 221 entries at 43 bytes each. See the names here

Format:

00: Family:
  00 = Slime
  01 = Dragon
  02 = Beast
  03 = Flying
  04 = Plant
  05 = Bug
  06 = Devil
  07 = Zombie
  08 = Material
  09 = ???  (Boss)
01: Base level cap
02: Experience table index
03: Percentage of females:
  v  = raw val (F:M ratio)
  00 =   0/256 (0:100)
  01 =  26/256 (13:115 ~ 10:90)
  02 = 128/256 (50:50)
  03 = 214/256 (107:21 ~ 84:16)
04: ?
06: Base skills (3 skills, 1 byte per)
09: ?
0F: Resistances (27 bytes)
2A: ?

Bank 41

There's a table at ROM41:4007 which points to the various string tables stored in this bank.

Personality name tables

ROM41:4997 personality name pointer table, size of 2x27, all pointing to within this bank.
   These are indexed by (idx(Charge) * 9 + idx(Mixed) * 3 + idx(Cautious)) where idx(x) is:
    * 0 if x >= 0xC0
    * 1 if 0x40 <= x < 0xC0
    * 2 if x < 0x40
   Effectively this means the indexes are best to worst, worsening Cautious first, then carrying from Mixed, etc.
ROM41:7159 personality names start here, each terminated by F0, in the order specified by the pointer table.

Personality adjustment tables

These tables are 4x8, each row containing 1 byte each of the adjustments for Charge, Mixed, Cautious, and Motivation respectively. Each table represents what happens when you select a certain Plan in battle. The row corresponds to a combination of the monster's current Motivation and level. Note that selecting Fight makes no adjustments to personality stats.

Run

ROM50:59B0
   -4, 0, 0, -10  # Motivation < 151  &&       Level <  10
   -3, 0, 0, -5   # Motivation < 151  && 10 <= Level <  20
   -2, 0, 0, -3   # Motivation < 151  && 20 <= Level <  30
   -1, 0, 0, -2   # Motivation < 151  &&       Level >= 30
   -8, 0, 0, -15  # Motivation >= 151 &&       Level <  10
   -6, 0, 0, -10  # Motivation >= 151 && 10 <= Level <  20
   -4, 0, 0, -5   # Motivation >= 151 && 20 <= Level <  30
   -2, 0, 0, -3   # Motivation >= 151 &&       Level >= 30

Charge

ROM57:70A9
   7, -1, 0, 3   # Motivation < 151  &&       Level <  10
   5, -1, 0, 2   # Motivation < 151  && 10 <= Level <  20
   3, -1, 0, 1   # Motivation < 151  && 20 <= Level <  30
   2, -1, 0, 1   # Motivation < 151  &&       Level >= 30
   10, -1, 0, 4  # Motivation >= 151 &&       Level <  10
   7, -1, 0, 3   # Motivation >= 151 && 10 <= Level <  20
   5, -1, 0, 2   # Motivation >= 151 && 20 <= Level <  30
   5, 0, 0, 1    # Motivation >= 151 &&       Level >= 30

Mixed

ROM57:70C9
   0, 7, -2, 3   # Motivation < 151  &&       Level <  10
   0, 5, -2, 2   # Motivation < 151  && 10 <= Level <  20
   0, 4, -1, 1   # Motivation < 151  && 20 <= Level <  30
   0, 3, -1, 1   # Motivation < 151  &&       Level >= 30
   0, 10, -3, 4  # Motivation >= 151 &&       Level <  10
   0, 7, -2, 3   # Motivation >= 151 && 10 <= Level <  20
   0, 5, -1, 2   # Motivation >= 151 && 20 <= Level <  30
   0, 5, 0, 1    # Motivation >= 151 &&       Level >= 30

Cautious

ROM57:70E9
   -2, 0, 7, 3   # Motivation < 151  &&       Level <  10
   -2, 0, 5, 2   # Motivation < 151  && 10 <= Level <  20
   -1, 0, 4, 1   # Motivation < 151  && 20 <= Level <  30
   -1, 0, 3, 1   # Motivation < 151  &&       Level >= 30
   -2, 0, 10, 4  # Motivation >= 151 &&       Level <  10
   -2, 0, 7, 3   # Motivation >= 151 && 10 <= Level <  20
   -1, 0, 5, 2   # Motivation >= 151 && 20 <= Level <  30
   0, 0, 5, 1    # Motivation >= 151 &&       Level >= 30

Command

ROM57:7109
   0, 0, 0, -1  # Motivation < 151  &&       Level <  10
   0, 0, 0, -2  # Motivation < 151  && 10 <= Level <  20
   0, 0, 0, -2  # Motivation < 151  && 20 <= Level <  30
   0, 0, 0, -1  # Motivation < 151  &&       Level >= 30
   0, 0, 0, -1  # Motivation >= 151 &&       Level <  10
   0, 0, 0, -2  # Motivation >= 151 && 10 <= Level <  20
   0, 0, 0, -2  # Motivation >= 151 && 20 <= Level <  30
   0, 0, 0, -1  # Motivation >= 151 &&       Level >= 30

Bank 52

Skill functions

52:4011 SkillFunctionTable
52:41CD SkillBlaze
52:41D4 SkillFirebal
52:41DB SkillBang
52:41E2 SkillInfernos
52:41E9 SkillIceBolt
52:41F0 SkillBolt
52:41F7 SkillBeat
52:422B SkillSacrifice
52:4235 SkillSleep
52:427C SkillStopSpell
52:42AA SkillSurround
52:42D8 SkillPanicAll
52:4308 SkillRobMagic
52:4330 SkillTakeMagic
52:434A SkillSap
52:436D SkillUpper
52:4385 SkillSlow
52:43A8 SkillSpeed
52:43C0 SkillBarrier
52:43FB SkillTwinHits
52:4415 SkillMagicWall
52:4434 SkillMagicBack
52:446C SkillTransform
52:4479 SkillIRONIZE
52:447F SkillIronize
52:44C4 SkillHeal
52:44F8 SkillVivify
52:457E SkillFarewell
52:458F SkillAntidote
52:45A7 SkillNumbOff
52:45D8 SkillDeChaos
52:45FE SkillCurseOff
52:4616 SkillChance
52:4625 SkillPoisonHit_StepGuard_Whistle_Attack_Run
52:462F SkillPsycheUp_TwinSlash
52:464C SkillRamming
52:4653 SkillBeserker
52:467C SkillKamikaze
52:4683 SkillMassacre
52:46BE SkillChargeUP
52:46CF SkillHighJump
52:470F SkillSuckAir
52:4720 SkillFireSlash
52:472A SkillBoltSlash
52:4734 SkillVacuSlash
52:473E SkillIceSlash
52:4748 SkillMetalCut
52:4752 SkillDrakSlash
52:475C SkillBeastCut
52:4766 SkillBirdBlow
52:4770 SkillDevilCut
52:477A SkillZombieCut
52:4784 SkillCleanCut
52:478E SkillMultiCut
52:4798 SkillBiAttack
52:480C SkillCallHelp
52:4888 SkillFocus
52:4897 SkillSquallHit
52:48B4 SkillRainSlash
52:4918 SkillWindBeast
52:492B SkillRockThrow
52:4932 SkillFireAir
52:493C SkillFrigidAir
52:4946 SkillBigBang
52:494D SkillMegaMagic
52:4954 SkillPalsyAir
52:497B SkillPoisonGas
52:49D2 SkillCurse
52:4A00 SkillAhhh
52:4A22 SkillSandStorm
52:4A57 SkillEerieLite
52:4A7B SkillOddDance
52:4AA3 SkillSideStep
52:4AC5 SkillLureDance
52:4AE7 SkillLushLicks
52:4B34 SkillLegSweep
52:4B68 SkillWarCry
52:4B92 SkillImitate
52:4BA1 SkillDeMagic_ThickFog
52:4BAB SkillSurge
52:4BB6 SkillUltraDown
52:4BD0 SkillTatsuCall
52:4C31 SkillCover
52:4C3B SkillTailWind
52:4C72 SkillDodge
52:4C81 SkillBladeD_Defense
52:4CA5 SkillSuckAll
52:4CDC SkillDanceShut
52:4D0A SkillMouthShut
52:4D38 SkillMeditate
52:4D92 SkillLifeSong
52:4DE9 SkillLifeDance
52:4E0A SkillDaze
52:4E0E SkillBeDragon
52:4E15 SkillSmashlime
52:4E1F SkillSheldodge
52:4E29 SkillBranching
52:4E33 SkillGigaSlash
52:4E3A SkillRUN
52:4E6D SkillAhhh
52:4E8A SkillHitAlly
52:4EA4 SkillHitEnemy
52:4EBE SkillHitRandom
52:4ED8 SkillTrip
52:4EE3 SkillScared
52:4EE7 SkillParalyze
52:4EF9 SkillSmashed
52:4F2C SkillHealUsAll
52:4F35 SkillALLCHANGE
52:4F54 SkillBIGSLEEP
52:4F7F SkillMP0
52:4FA1 SkillCALLEVIL
52:4FCC SkillFREEZY
52:4FFC SkillRESTOREMP
52:501F SkillMETEOR

Family check functions

52:6304 CheckIsSlime
52:6311 CheckIsDragon
52:631f CheckIsBeast
52:632d CheckIsFlying
52:633b CheckIsPlant
52:6349 CheckIsBug
52:6357 CheckIsDevil
52:6365 CheckIsZombie
52:6373 CheckIsMaterial
<pre>

=== Math functions ===
These are used commonly in the skill functions to calculate damage and such

<pre>
52:6b2a BCsrl3  BC >>= 3
52:6b2e BCsrl2  BC >>= 2
52:6b32 BCsrl1  BC >>= 1
52:6b37 HLsrl4  HL >>= 4
52:6b3b HLsrl3  HL >>= 3
52:6b3f HLsrl2  HL >>= 2
52:6b43 HLsrl1  HL >>= 1