Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Wizardry II: Knight of Diamonds (NES)/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Wizardry II: Knight of Diamonds (NES).

(A brief note: The US version of the game is presumed here. The 16-byte header is also included; subtract 16 bytes if viewing the ROM in an NES emulator versus directly in a hex editor.)

Premade Character Stats

This is the data for the group of 6 pre-made characters in a "brand new game state". Each character uses 96 bytes of data, and the data begins at 0x8E4B. All values are hexadecimal values unless otherwise specified. If a range or table of values is given, presume going outside of the specified values is, at best, inadvisable. Character one will be discussed byte-by-byte; the same format is used for characters 2-6.

  • 0x8E4C to 0x---- (0001) = Should always be #$02. As a whole, this character byte determines the "meta-status" of the character—if they're available to be picked, if the data associated with them is safe to erase, etc. #$02 is the "character is available for selection" status.
  • 0x8E4D to 0x---- (0001) = Length of the character's name
  • 0x8E4E to 0x8E55 (0008) = The character's name. This is visible in plaintext in the ROM. If less than 8 characters, right-padded with spaces (#$20)
  • 0x8E56 to 0x---- (0001) = The Race, Class, and Alignment of your character.

First, determine the race, as follows:
00 = Human
20 = Elf
40 = Dwarf
60 = Gnome
80 = Hobbit

Then add the following values for your character's class:
00 = Fighter
04 = Mage
08 = Cleric/Priest (In the Famicom version)
0C = Thief
10 = Wizard/Bishop (In the Famicom version)
14 = Samurai
18 = Lord
1C = Ninja

Finally, add 00, 01, 02 or 03 to these numbers to determine their alignment.
00 = Good
01 = Neutral
02 = Evil
03 = (Also Neutral. My guess without digging into the code is that the game is checking the smallest bit for the Neutral status, then only moving to check Good/Evil if it determines the Neutral bit is 0)

So, as an example, setting this value to #$4A will give you a Dwarven (40) Cleric (08) that is Evil (02)

  • 0x8E57 to 0x---- (0001) = The character's starting Strength
  • 0x8E58 to 0x---- (0001) = The character's starting I.Q.
  • 0x8E59 to 0x---- (0001) = The character's starting Piety
  • 0x8E5A to 0x---- (0001) = The character's starting Vitality
  • 0x8E5B to 0x---- (0001) = The character's starting Agility
  • 0x8E5C to 0x---- (0001) = The character's starting Luck
  • 0x8E5D to 0x8E62 (0006) = How much Gold the character is carrying. Notably, this is not hex, but the literal decimal values. In other words, if these six values are #$00 #$00 #$00 #$25 #$37 #$16, it means your character has 253716 Gold.
  • 0x8E63 to 0x8E68 (0006) = How much Experience the character has. Again, this is the literal decimal values.
  • 0x8E69 to 0x8E6A (0002) = Current character HP, smaller byte first
  • 0x8E6B to 0x8E6C (0002) = Maximum character HP, smaller byte first
  • 0x8E6D to 0x8E6E (0002) = Character level, larger byte first
  • 0x8E6F to 0x---- (0001) = Character status:

00 = Ok
01 = Asleep
02 = Afraid
03 = Paralyze
04 = Petrify
05 = Dead
06 = Ashes
07 = Lost
08 = Poisoned
09 = P-Lyze (NOTE: I'm not sure what the difference is between this and 03, if any. It may just be a display thing, where one displays on your bottom bar and the other when you go to inspect the character.)
0A = Ok

  • 0x8E70 to 0x---- (0001) = Character Age
  • 0x8E71 to 0x---- (0001) = ????
  • 0x8E72 to 0x---- (0001) = Character Armor Class. If less than 0, begins counting down from $#FF = -1, $#FE = -2, etc. -99 is as low as the game will "normally" go, and even this requires a level several-hundred Ninja. Around -20 is as low as you're "typically" likely to see.
  • 0x8E73 to 0x---- (0001) = Number of Level 1 Mage Spell casts. The first ("bigger") nibble is your current casts, the second ("smaller") is your maximum. EG: #$34 in here you have 3 Level 1 mage casts remaining out of a maximum of 4. Both max out at 9. Subsequent spell cast bytes work the same way.
  • 0x8E74 to 0x---- (0001) = Number of Level 2 Mage Spell casts
  • 0x8E75 to 0x---- (0001) = Number of Level 3 Mage Spell casts
  • 0x8E76 to 0x---- (0001) = Number of Level 4 Mage Spell casts
  • 0x8E77 to 0x---- (0001) = Number of Level 5 Mage Spell casts
  • 0x8E78 to 0x---- (0001) = Number of Level 6 Mage Spell casts
  • 0x8E79 to 0x---- (0001) = Number of Level 7 Mage Spell casts
  • 0x8E7A to 0x---- (0001) = Number of Level 1 Cleric Spell casts
  • 0x8E7B to 0x---- (0001) = Number of Level 2 Cleric Spell casts
  • 0x8E7C to 0x---- (0001) = Number of Level 3 Cleric Spell casts
  • 0x8E7D to 0x---- (0001) = Number of Level 4 Cleric Spell casts
  • 0x8E7E to 0x---- (0001) = Number of Level 5 Cleric Spell casts
  • 0x8E7F to 0x---- (0001) = Number of Level 6 Cleric Spell casts
  • 0x8E80 to 0x---- (0001) = Number of Level 7 Cleric Spell casts
  • 0x8E81 to 0x---- (0001) = Representation of which Level 1 Mage spells you've learned. Each bit in the byte represents a particular spell, beginning with the smallest. Which spells correspond to which values will eventually be uploaded to a separate table. Subsequent spell bytes work the same way.
  • 0x8E82 to 0x---- (0001) = Level 2 Mage spells learned
  • 0x8E83 to 0x---- (0001) = Level 3 Mage spells learned
  • 0x8E84 to 0x---- (0001) = Level 4 Mage spells learned
  • 0x8E85 to 0x---- (0001) = Level 5 Mage spells learned
  • 0x8E86 to 0x---- (0001) = Level 6 Mage spells learned
  • 0x8E87 to 0x---- (0001) = Level 7 Mage spells learned
  • 0x8E88 to 0x---- (0001) = Level 1 Cleric spells learned
  • 0x8E89 to 0x---- (0001) = Level 2 Cleric spells learned
  • 0x8E8A to 0x---- (0001) = Level 3 Cleric spells learned
  • 0x8E8B to 0x---- (0001) = Level 4 Cleric spells learned
  • 0x8E8C to 0x---- (0001) = Level 5 Cleric spells learned
  • 0x8E8D to 0x---- (0001) = Level 6 Cleric spells learned
  • 0x8E8E to 0x---- (0001) = Level 7 Cleric spells learned
  • 0x8E8F to 0x---- (0001) = Status of Inventory Item 1 for the character.

00 = Item not equipped
20 = Item not identified
40 = Character is cursed with the item
80 = Item is equipped
Values are additive, so EG #$A0 means you've equipped an unidentified item. Subsequent inventory item status bytes work the same way.

  • 0x8E90 to 0x---- (0001) = Status of Inventory Item 2 for the character
  • 0x8E91 to 0x---- (0001) = Status of Inventory Item 3 for the character
  • 0x8E92 to 0x---- (0001) = Status of Inventory Item 4 for the character
  • 0x8E93 to 0x---- (0001) = Status of Inventory Item 5 for the character
  • 0x8E94 to 0x---- (0001) = Status of Inventory Item 6 for the character
  • 0x8E95 to 0x---- (0001) = Status of Inventory Item 7 for the character
  • 0x8E96 to 0x---- (0001) = Status of Inventory Item 8 for the character
  • 0x8E97 to 0x8E9E (0008) = Your inventory. 8E97 is your first item, 8E98 your second, etc. Each value from #$00 to #$89 corresponds to an item, the table of which will eventually be uploaded separately. #$FF means the slot is blank.
  • 0x8E9F to 0x---- (0001) = How many items are in the character's inventory. If editing character inventories, remember to edit this byte as well or your edits will not display or otherwise "stick".
  • 0x8EA3 to 0x---- (0001) = Markers that denote your character status in terms of having beaten the trilogy of games, found on the Character Status screen after their name. Normally in the US version you can only have one of 00, 02, or 08, due to a lack of file transfer from game to game. The other statuses are still in the game, though. These are also additive (With the exception of 02 and 08–02 overrides 08), so EG a character with this byte set to 03 will have [>G] next to their name in the status screen.


00 = No symbols
01 = [>] (The "Chevron of Elite Rank", denoting a character who has beaten Wizardry: Proving Grounds of the Mad Overlord
02 = [G] (The "Mark of Gnilda", for the character who returned from the Ruins with the Staff of Gnilda in Wizardry: The Knight of Diamonds
04 = [*] (The "Star of Llylgamyn", for a character who returned from the Legacy of Llygamyn with the Orb of Earithin)
08 = [K] (The "Knight of the City" marker, referring to a character who helped in Wizardry: The Knight of Diamonds)

At present, it's unclear what the remaining 11 character bytes do, but 0x8EA5, 0x8EA9 and 0x8EAA appear to be related to whether the character is in your party or not. 0x8EA5 in particular appears to be 00 = Not in party and 80 = In party.

  • 0x8EAB to 0x8F0A (0060) = Character 2's data
  • 0x8F0B to 0x8F6A (0060) = Character 3's data
  • 0x8F6B to 0x8FCA (0060) = Character 4's data
  • 0x8FCB to 0x902A (0060) = Character 5's data
  • 0x902B to 0x908A (0060) = Character 6's data

Created Character Starting Stats for Each Race

This table covers the starting stats for each race. The maximum stats for a given character are their minimums plus 10 (#$0A); this #$0A is hard-coded somewhere. Note that messing with these minimums or the maximum may have unintended side effects elsewhere. In particular, the Vitality stat uses a lookup table elsewhere in the ROM to determine HP bonus/penalty on level up; when Vitality goes above 20 (#$14), it begins looking up values outside of the table. Additionally, updating these starting stats to high enough values may cause them to display weirdly during character creation, though they'll look fine in the status screen after creation.

Memory Address Corresponding Starting Stat
0x1DBDD Human Strength
0x1DBDE Human I.Q.
0x1DBDF Human Piety
0x1DBE0 Human Vitality
0x1DBE1 Human Agility
0x1DBE2 Human Luck
0x1DBE3 Elf Strength
0x1DBE4 Elf I.Q.
0x1DBE5 Elf Piety
0x1DBE6 Elf Vitality
0x1DBE7 Elf Agility
0x1DBE8 Elf Luck
0x1DBE9 Dwarf Strength
0x1DBEA Dwarf I.Q.
0x1DBEB Dwarf Piety
0x1DBEC Dwarf Vitality
0x1DBED Dwarf Agility
0x1DBEE Dwarf Luck
0x1DBEF Gnome Strength
0x1DBF0 Gnome I.Q.
0x1DBF1 Gnome Piety
0x1DBF2 Gnome Vitality
0x1DBF3 Gnome Agility
0x1DBF4 Gnome Luck
0x1DBF5 Hobbit Strength
0x1DBF6 Hobbit I.Q.
0x1DBF7 Hobbit Piety
0x1DBF8 Hobbit Vitality
0x1DBF9 Hobbit Agility
0x1DBFA Hobbit Luck

Dungeon Data

The dungeon data is contained in a 9600-byte chunk beginning at 0x1201E. Each Floor takes up 1200 bytes, divided up into 3 400-byte "sub-chunks". Each "sub-chunk" defines a different characteristic of the maze—the first is the wall data for each square, the second is the "type" of square, and the third internally defines which room a given square is in (For determining, eg, spike tile triggering).

  • 0x1201E to 0x121AD (0190) = Floor 1's wall data
  • 0x121AE to 0x1233D (0190) = Floor 1's tile data
  • 0x1233E to 0x124CD (0190) = Floor 1's room data
  • 0x124CE to 0x1265D (0190) = Floor 2's wall data
  • 0x1265E to 0x127ED (0190) = Floor 2's tile data
  • 0x127EE to 0x1297D (0190) = Floor 2's room data
  • 0x1297E to 0x12B0D (0190) = Floor 3's wall data
  • 0x12B0E to 0x12C9D (0190) = Floor 3's tile data
  • 0x12C9E to 0x12E2D (0190) = Floor 3's room data
  • 0x12E2E to 0x12FBD (0190) = Floor 4's wall data
  • 0x12FBE to 0x1314D (0190) = Floor 4's tile data
  • 0x1314E to 0x132DD (0190) = Floor 4's room data
  • 0x132DE to 0x1346D (0190) = Floor 5's wall data
  • 0x1346E to 0x135FD (0190) = Floor 5's tile data
  • 0x135FE to 0x1378D (0190) = Floor 5's room data
  • 0x1378E to 0x1391D (0190) = Floor 6's wall data
  • 0x1391E to 0x13AAD (0190) = Floor 6's tile data
  • 0x13AAE to 0x13C3D (0190) = Floor 6's room data

How Wall Data Works

In each 400-byte chunk of wall data, the first byte is 0 East 0 North, the next byte is 1 East 0 North, the next 2 East 0 North, then so on to 19 East 0 North. The byte after that is 0 East 1 North, then 1 East 1 North, then 2 East 1 North, and so on until you get to 19 East 19 North. Follow the table below to put a wall or door in a given direction. Because each square defines its directions individually, this means you can make EG, 1-way doors by only defining a door in one direction.

Add this value To do this
00 Nothing! (Open space all around)
01 North Wall
02 North Door
03 North Secret Door
04 East Wall
08 East Door
0C East Secret Door
10 South Wall
20 South Door
30 South Secret Door
40 West Wall
80 West Door
C0 West Secret Door

Example: a value of "16" means there is a door to the north, a wall to the east, a wall to the south, and open space to the west (02 + 04 + 10 = 16).

How Tile Data Works

Here, a value of 00 to 1F is an ordinary tile. 20 to 2F are special tiles; their exact data is specified elsewhere in the ROM. Where and what it means is defined here. For now, just know each floor defines these differently ("23" is nothing on Floor 1, the "Three roads to follow..." message in Floor 2, and "Rock!" on Floor 5, for instance). While they're not intended to be used in this way, if you want to be sadistic, 30, 31, and 32 are the various "Your teleport went catastrophically wrong and your bodies have been dumped back at the castle" messages ("You teleported into rock!", "You materialized in mid-air..." and "You appeared in the Castle moat..." respectively). Adding 40 to these values make a Dark tile, and adding 80 is, I believe, for a "spiked encounter" when going through a door.

Experience Requirements

These begin at address 0x1CB2D. For this section, the Fighter requirements will be discussed in detail. After that, only the ranges for the other seven classes will be noted, as the format is the same for all classes. For these requirements, similar to the experience for the default characters, these are the literal decimal values as represented in hex—three bytes of #$001000, for instance, mean the requirement is 1000 experience points for the level.

Fighter Level Requirements

  • 0x1CB2D to 0x1CB2F (0003) = Total experience required for Fighter Level 2
  • 0x1CB30 to 0x1CB32 (0003) = Total experience required for Fighter Level 3
  • 0x1CB33 to 0x1CB35 (0003) = Total experience required for Fighter Level 4
  • 0x1CB36 to 0x1CB38 (0003) = Total experience required for Fighter Level 5
  • 0x1CB39 to 0x1CB3B (0003) = Total experience required for Fighter Level 6
  • 0x1CB3C to 0x1CB3E (0003) = Total experience required for Fighter Level 7
  • 0x1CB3F to 0x1CB41 (0003) = Total experience required for Fighter Level 8
  • 0x1CB42 to 0x1CB44 (0003) = Total experience required for Fighter Level 9
  • 0x1CB45 to 0x1CB47 (0003) = Total experience required for Fighter Level 10
  • 0x1CB48 to 0x1CB4A (0003) = Total experience required for Fighter Level 11
  • 0x1CB4B to 0x1CB4D (0003) = Total experience required for Fighter Level 12
  • 0x1CB4E to 0x1CB50 (0003) = Total experience required for Fighter Level 13
  • 0x1CB51 to 0x1CB56 (0006) = A 6-byte blank buffer

At this point, it gets a bit strange. The requirements shift from total experience to acquire a level, to total additional experience to acquire additional levels, starting from a base level of 13. Additionally, the values go from 3 bytes each to 6 bytes each.

  • 0x1CB57 to 0x1CB5C (0006) = Additional experience required for 1 additional Fighter level (Total Level 14)
  • 0x1CB5D to 0x1CB62 (0006) = Additional experience required for 2 additional Fighter levels (Total Level 15)
  • 0x1CB63 to 0x1CB68 (0006) = Additional experience required for 3 additional Fighter levels (Total Level 16)
  • 0x1CB69 to 0x1CB6E (0006) = Additional experience required for 4 additional Fighter levels (Total Level 17)
  • 0x1CB6F to 0x1CB74 (0006) = Additional experience required for 5 additional Fighter levels (Total Level 18)
  • 0x1CB75 to 0x1CB7A (0006) = Additional experience required for 6 additional Fighter levels (Total Level 19)
  • 0x1CB7B to 0x1CB80 (0006) = Additional experience required for 7 additional Fighter levels (Total Level 20)
  • 0x1CB81 to 0x1CB86 (0006) = Additional experience required for 8 additional Fighter levels (Total Level 21)
  • 0x1CB87 to 0x1CB8C (0006) = Additional experience required for 9 additional Fighter levels (Total Level 22)
  • 0x1CB8D to 0x1CB92 (0006) = Another 6-byte blank buffer
  • 0x1CB93 to 0x1CB98 (0006) = Additional experience required for 10 additional Fighter levels (Total Level 23)
  • 0x1CB99 to 0x1CB9E (0006) = Additional experience required for 20 additional Fighter levels (Total Level 33)
  • 0x1CB9F to 0x1CBA4 (0006) = Additional experience required for 30 additional Fighter levels (Total Level 43)
  • 0x1CBA5 to 0x1CBAA (0006) = Additional experience required for 40 additional Fighter levels (Total Level 53)
  • 0x1CBAB to 0x1CBB0 (0006) = Additional experience required for 50 additional Fighter levels (Total Level 63)
  • 0x1CBB1 to 0x1CBB6 (0006) = Additional experience required for 60 additional Fighter levels (Total Level 73)
  • 0x1CBB7 to 0x1CBBC (0006) = Additional experience required for 70 additional Fighter levels (Total Level 83)
  • 0x1CBBD to 0x1CBC2 (0006) = Additional experience required for 80 additional Fighter levels (Total Level 93)
  • 0x1CBC3 to 0x1CBC8 (0006) = Additional experience required for 90 additional Fighter levels (Total Level 103)

Other Class Requirements

Other classes are listed in the same order as the class byte in the Default Character Data above, and follow the same format as the Fighter class. For reference, these ranges and the corresponding classes are as follows:

  • 0x1CBC9 to 0x1CC64 (009C) = Mage level requirements
  • 0x1CC65 to 0x1CD00 (009C) = Cleric/Priest level requirements
  • 0x1CD01 to 0x1CD9C (009C) = Thief level requirements
  • 0x1CD9D to 0x1CE38 (009C) = Wizard/Bishop level requirements
  • 0x1CE39 to 0x1CED4 (009C) = Samurai level requirements
  • 0x1CED5 to 0x1CF70 (009C) = Lord level requirements
  • 0x1CF71 to 0x1D00C (009C) = Ninja level requirements

Minimum Class Requirements

These begin at 0x1DAAD. There are 8 bytes per class, and 8 classes, for a total of 64 bytes. As with Experience Requirements above, the Fighter section will be discussed in detail, then the overall ranges for every other class will be noted.

Fighter Requirements

  • 0x1DAAD = Minimum Fighter Strength
  • 0x1DAAE = Minimum Fighter I.Q.
  • 0x1DAAF = Minimum Fighter Piety
  • 0x1DAB0 = Minimum Fighter Vitality
  • 0x1DAB1 = Minimum Fighter Agility
  • 0x1DAB2 = Minimum Fighter Luck
  • 0x1DAB3 = Alignments allowed. #$01 = Good, #$02 = Neutral, #$04 = Evil. These are additive; so EG #$05 = Good or Evil are allowed. #$07 = all three alignments are allowed.
  • 0x1DAB4 = ??? Since each value in this slot is double the previous value, my guess is this is a byte that "determines" class elsewhere in the ROM.

Other Class Requirements

  • 0x1DAB5 to 0x1DABC (0008) = Minimum Requirements for a Mage
  • 0x1DABD to 0x1DAC4 (0008) = Minimum Requirements for a Cleric/Priest
  • 0x1DAC5 to 0x1DACC (0008) = Minimum Requirements for a Thief
  • 0x1DACD to 0x1DAD4 (0008) = Minimum Requirements for a Wizard/Bishop
  • 0x1DAD5 to 0x1DADC (0008) = Minimum Requirements for a Samurai
  • 0x1DADD to 0x1DAE4 (0008) = Minimum Requirements for a Lord
  • 0x1DAE5 to 0x1DAEC (0008) = Minimum Requirements for a Ninja