Contents

Technical Documentation - Dungeon Master II Music triggers (CD.DAT, MD.DAT, SONGLIST.DAT)

Overview

In the versions of Dungeon Master II that have music, there is a data file that defines the dungeon locations where a music track should be played.
The file consists of a list of 4 bytes records. The list is not limited in size. Each time the party moves, the game checks that list and if it finds an entry corresponding to the current party location, it plays the specified music track.
Each version of the game uses one of two formats for this data file.

Note: the dungeon consists of a set of 44 maps (each up to 32x32 squares). Each map has an associated level and multiple maps may be located on the same level, like level 6 in Dungeon Master II. Each map also has X and Y offsets to position the maps on the level.

Format 1: level coordinates

This format is used in PC-9821, FM-Towns, Macintosh JP and Sega CD / Mega CD versions. They all contain the same 40 bytes file named CD.DAT. It defines 10 locations in the dungeon where music is played.
There is no wildcard to apply the same music to a whole level.

  • Byte 0: X coordinate in the level: X coordinate in the map (value between 0 and 31) added to the X offset
  • Byte 1: Y coordinate in the level: Y coordinate in the map (value between 0 and 31) added to the Y offset
  • Byte 2: Level index
  • Byte 3: Music track index to play at the location

Format 2: map coordinates

This format is used in Amiga and Macintosh US versions. They both contain a 176 bytes file but with a different name and content for each version: CD.DAT (Amiga), MD.DAT (Macintosh US). It defines a music to play for each of the 44 maps in the dungeon.
There is a wildcard to apply the same music to a whole map: if the X coordinate is set to 0xFF then the specified Y coordinate is ignored and the music is played everywhere on the specified map.
All three versions have both X and Y set to 0xFF for all 44 maps but this is not mandatory.

  • Byte 0: X coordinate in the map (value between 0 and 31) without adding the offset
  • Byte 1: Y coordinate in the map (value between 0 and 31) without adding the offset
  • Byte 2: Map index
  • Byte 3: Music track index to play at the location

Format 3: no coordinates

This format is used in PC versions. They contain a 63 bytes file named SONGLIST.DAT. It defines a music to play for each of the maximum allowed 63 maps in the dungeon. Only 44 maps are actually present in the dungeon.dat file.

There are 29 possible songs stored at the end of the GRAPHICS.DAT file. The byte values found in SONGLIST.DAT range from 0 to 1Ch (28).
Each byte in SONGLIST.DAT is used as an index in the GRAPHICS.DAT file. For example, in order to find which music to play for map #9, you need to read the 9th byte in SONGLIST.DAT (offset 8) and then add 5595 to its value. This will give you the index of the item containing the music to play.

The size of the SONGLIST.DAT file is 63 bytes, and there are 46 'real' values inside, the others at the end are FFh bytes.

As there are only 44 maps in the released dungeon.dat, only the first 44 bytes of the SONGLIST.DAT file are used.
The additional bytes are probably left from development versions and are probably ignored by the game engine. Note that some versions of Dungeon Master II have more maps in the dungeon, like Dungeon Master II for PC-9801 where there are 54 maps defined in the dungeon.

Thanks to Sphenx for his information about this file format.