Contents

Technical Documentation - File Formats - Data Files

Data files description

The game data (images, sounds, music, text, etc...) of Dungeon Master, Chaos Strikes Back and Dungeon Master II is stored in data files that share the same general file format. They are made of two main parts:

  • The header part describes the list of items stored in the file.
  • The data part follows the header part and contains each item's data.

Each item contains a certain type of data. In this document and in the sample script, each data type was given a name like IMG1 or IMG2 for different image encodings, SND1 or SND2 for sound encodings, etc... Please refer to the "Item data formats" section below for a description of each data format.

A graphics item cannot be larger than 32 KB (32768 bytes). The item containing the portraits can be expanded to store up to 64 portraits instead of only 24 as in the original games. The image should then contain 8 lines of 8 portraits. It is not possible to add more portraits because of the 32 KB item size limitation. [Information supplied by Meynaf]

The following terms are used in this document for basic data types: a nibble (4 bits), a byte (8 bits), a word (16 bits, two bytes) and a dword (32 bits, four bytes).

Detailed file structure

Header

There are three slightly different header formats depending on the game and version.
The header contains only words of data (and a dword in the DMII format). These words and dwords can be stored as little endian or big endian depending on the data file.
Please refer to the table below to know which endian and file format are used in each data file.

DMCSB1

This format is used in earlier versions of Dungeon Master and Chaos Strikes Back. In this format, the header contains the number of items in the file and the compressed and decompressed sizes of each item.

  • 1 word: Number of items in file.
  • 1 word for each item: Compressed size of each item.
  • 1 word for each item: Decompressed size of each item.
DMCSB2

This format is used in later versions of Dungeon Master and Chaos Strikes Back. In this format, the header contains the same information as in the DMCSB1 format as well as an additional file signature and two words of attributes for each item.

  • 1 word: File Signature (8001h in big endian)
  • 1 word: Number of items in file.
  • 1 word for each item: Compressed size of each item.
  • 1 word for each item: Decompressed size of each item.
  • 2 consecutive words for each item: Items attributes.
DMII

This format is used in all versions of Dungeon Master II. In this format, the header contains a file signature, the number of items in the file, the size of the first item stored as a double word and the size of all other items.

  • 1 word: File Signature (8005h in big endian). In Dungeon Master II for FM-Towns, the signature is 8004h.
  • 1 word: Number of items in file.
  • 1 dword: Size of the first item in the file.
  • 1 word for each item except the first one: Size of each item
Items Attributes

Here are the contents of items attributes in GRAPHICS.DAT DM PC v3.4 English and Multilingual:

  • IMG3 items: First two words in item data taken as little endian (width and height of image)
  • SND3 items: First word of item data taken as big endian and converted to little endian, the second word is made up of a 00h byte as most significant byte, and a least significant byte which value is equal to the value of the fourth byte of item data - 80h (stored as a signed byte value). For example, if the fourth byte of item data has the value 89h, then the least significant byte of the second attibute word will be 89h - 80h = 09h. If the fourth byte of item data has the value 79h, then the least significant byte of the second attibute word will be 79h - 80h = F9h (signed byte)
  • TXT1 and TXT2 items: First two words in item data taken as big endian and converted to little endian
  • FNT1 items: First two words in item data taken as big endian and converted to little endian
  • RAW1 items: First two words in item data taken as little endian
  • NULL items: 0000h and 0000h
Endians and File Formats

The following table lists the endian and file format used in each data file:

Data File Number of Items Endian Format Contains LZW compressed items
GRAPHICS.GAME DM Apple IIGS 575 LITTLE DMCSB1 -
GRAPHICS.DAT DM FM-Towns 575 LITTLE DMCSB1 -
GRAPHICS.DAT DM Amiga v2.0 575 BIG DMCSB1 -
GRAPHICS.DAT DM Amiga v2.0 FR 575 BIG DMCSB1 -
GRAPHICS.DAT DM Amiga v2.2 GE 575 BIG DMCSB1 -
GRAPHICS.DAT DM Atari ST v1.0 EN, v1.1 EN, v1.2 EN, v1.2 GE, v1.3 FR 563 BIG DMCSB1 Yes
GRAPHICS.DAT CSB Atari ST v2.0 EN, v2.1 EN 563 BIG DMCSB1 Yes
ANIMATE.DAT CSB Atari ST 87 BIG DMCSB1 -
HCSB.DAT CSB Amiga English Release 1 and Atari ST v2.0 4 BIG DMCSB1 -
HCSB.DAT CSB Amiga English Release 2 and 3 5 BIG DMCSB1 -
HCSB.DAT CSB Amiga French Release 5 BIG DMCSB1 -
HCSB.DAT CSB Amiga German Release 5 BIG DMCSB1 -
NAKED.AMG CSB Amiga Utility Disk English 6 BIG DMCSB1 -
NAKED.AMG CSB Amiga Utility Disk French and German 6 BIG DMCSB1 -
SONG.DAT DM PC v3.4 10 LITTLE DMCSB2 -
GRAPHICS.DAT DM PC v3.4 English 713 LITTLE DMCSB2 -
GRAPHICS.DAT DM PC v3.4 Multilingual 748 LITTLE DMCSB2 -
GRAPHICS.DAT DM Amiga v3.6 749 BIG DMCSB2 -
GRAPHICS.DAT DM X68000 562 BIG DMCSB2 -
GRAPHICS.DAT DM PC-9801 575 LITTLE DMCSB2 -
GRAPHICS.DAT CSB Amiga v3.1 EN, vXX 728 BIG DMCSB2 -
GRAPHICS.DAT CSB Amiga v3.1 EN FR GE, v3.3 EN FR GE 749 BIG DMCSB2 -
GRAPHICS.DAT CSB X68000 732 BIG DMCSB2 -
GRAPHICS.DAT CSB FM-Towns EN 728 LITTLE DMCSB2 -
GRAPHICS.DAT CSB FM-Towns JP 728 LITTLE DMCSB2 -
GRAPHICS.DAT CSB PC-9801 728 LITTLE DMCSB2 -
GRAPHICS.DAT DMII PC 0.9 Beta
This file is split in two parts. You can join them with the following command line: copy /b graphics.dat + graphic2.dat dm2pcb.dat.
3965 LITTLE DMII -
GRAPHICS.DAT DMII PC English 5624 LITTLE DMII -
GRAPHICS.DAT DMII PC German 5630 LITTLE DMII -
GRAPHICS.DAT DMII PC French 5636 LITTLE DMII -
GRAPHICS.DAT DMII PC Demo 3332 LITTLE DMII -
GRAPHICS.DAT DMII PC-9801
This file is split in two parts. You can join them with the following command line: copy /b graphics.dat + graphic2.dat dm2pc9801.dat.
3483 LITTLE DMII -
GRAPHICS.DAT DMII IBM PC-9821 3491 LITTLE DMII -
GRAPHICS.DAT DMII IBM PS/V
This file is split in two parts. You can join them with the following command line: copy /b graph1.dat + graph2.dat dm2ibmpsv.dat.
3491 LITTLE DMII -
GRAPHICS.DAT DMII Amiga 4630 BIG DMII -
GRAPHICS.DAT DMII Macintosh EN 4902 BIG DMII -
GRAPHICS.DAT DMII Macintosh EN Demo 2680 BIG DMII -
GRAPHICS.DAT DMII Macintosh JP 3399 BIG DMII -
GRAPHICS.DAT DMII Sega CD EN 3153 BIG DMII -
GRAPHICS.DAT DMII Sega CD JP 3163 BIG DMII -
GRAPHICS.DAT DMII FM-Towns 3407 LITTLE DMII (File signature is 8004h instead of 8005h) -

Data

The data section contains all items stored one after the other, until the end of the file. The size of each item is specified in the header section. The type of each item is not specified in the data file. That is the reason why the sample script uses .map files to know how to decode each item.

Please refer to the "Item data formats" section below for a complete description of each data format.

The following list will tell you which item data formats are used in each data file:

GRAPHICS.DAT DM PC v3.4 English
  • IMG3: 542 (0-11, 13-20, 22-23, 25-79, 86-125, 246-670). Empty image 16x4: 22.
  • SND3: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT1: 1 (694)
  • FNT1: 1 (695)
  • LAY1: 1 (696)
  • NULL: 135 (12, 21, 24, 80-85, 126-245, 676, 686, 697-700)
GRAPHICS.DAT DM PC v3.4 Multilingual
  • IMG3: 556 (0-11, 13-20, 22-23, 25-79, 86-125, 246-670, 728-734, 738-744). Empty image 16x4: 22.
  • SND3: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT2: 9 (694, 699-700, 735-737, 745-747)
  • FNT1: 1 (695)
  • LAY1: 1 (696)
  • NULL: 148 (12, 21, 24, 80-85, 126-245, 676, 686, 697-698, 713-727)
GRAPHICS.DAT DM Amiga v2.0 EN
  • IMG1: 532 (0-20, 22-532)
  • COD2: 3 (21, 538, 548)
  • SND2: 33 (533-537, 539-547, 549-555, 563-574)
  • TXT1: 1 (556)
  • FNT1: 1 (557)
  • I558: 1 (558)
  • I559: 1 (559)
  • I560: 1 (560)
  • I561: 1 (561)
  • I562: 1 (562)

Items 558-562 are not used (the data is also found directly inside the executable). The developpers probably forgot to remove them when porting the game from Atari ST. They were removed from all other Amiga versions.

GRAPHICS.DAT DM Amiga v2.1 EN and 2.2 EN
  • IMG1: 532 (0-20, 22-532)
  • COD2: 3 (21, 538, 548)
  • SND2: 33 (533-537, 539-547, 549-555, 563-574)
  • TXT1: 1 (556)
  • FNT1: 1 (557)
  • NULL: 5 (558-562)
GRAPHICS.DAT DM Amiga v2.0 FR, 2.0 GE and 2.2 GE
  • IMG1: 537 (0-20, 22-532, 558-562). Empty images 16x4: 558-562.
  • COD2: 3 (21, 538, 548)
  • SND2: 33 (533-537, 539-547, 549-555, 563-574)
  • TXT1: 1 (556)
  • FNT1: 1 (557)
GRAPHICS.DAT DM Amiga v3.6
  • IMG1: 684 (0-20, 22-670, 728-734, 738-744). Empty image 16x4: 22. Empty image 16x13: 80-85, 126-245.
  • COD2: 3 (21, 676, 686)
  • SND2: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT2: 9 (694, 699-700, 735-737, 745-747)
  • FNT1: 1 (695)
  • LAY1: 1 (696)
  • RAW2: 15 (713-726, 748)
  • NULL: 3 (697-698, 727)
GRAPHICS.DAT DM X68000
  • IMG1: 536 (0-20, 22-532, 558-561). Empty images 16x4: 11, 22, 24.
  • COD2: 3 (21, 538, 548)
  • SND4: 21 (533-537, 539-547, 549-555)
  • TXT2: 1 (556)
  • FNT1: 1 (557)
GRAPHICS.GAME DM Apple IIGS
  • IMG2: 538 (0-11, 13-20, 22-532, 538, 548, 558-562). Empty images 16x4: 22, 24, 538, 548, 558-562.
  • COD4: 1 (21)
  • IMG1: 1 (12)
  • SND2: 33 (533-537, 539-547, 549-555, 563-574)
  • TXT1: 1 (556)
  • FNT1: 1 (557)
GRAPHICS.DAT CSB Amiga vXX
  • IMG1: 670 (0-20, 22-670). Empty image 16x13: 22, 80-85, 126-245, 371-378. Empty Image 3x3: 600-602, 649, 669.
  • COD2: 3 (21, 676, 686)
  • SND2: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT1: 1 (694)
  • FNT1: 1 (695)
  • LAY1: 1 (696)
  • RAW2: 15 (713-727)
  • NULL: 4 (697-700)
GRAPHICS.DAT CSB Amiga v3.1 ML and v3.3 ML
  • IMG1: 684 (0-20, 22-670, 728-734, 738-744)
  • COD2: 3 (21, 676, 686)
  • SND2: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT2: 9 (694, 699-700, 735-737, 745-747)
  • FNT1: 1 (695)
  • LAY1: 1 (696)
  • RAW2: 15 (713-726, 748)
  • NULL: 3 (697-698, 727)
GRAPHICS.DAT DM Atari ST and CSB Atari ST (all versions: DM 1.0 EN, 1.1 EN, 1.2 EN, 1.2 GE and 1.3 FR, CSB 2.0 EN and 2.1 EN)
  • IMG1: 532 (0-20, 22-532). Empty images 16x4: 22, 24
  • COD1: 3 (21, 538, 548)
  • SND1: 21 (533-537, 539-547, 549-555)
  • TXT1: 1 (556)
  • FNT1: 1 (557)
  • I558: 1 (558)
  • I559: 1 (559)
  • I560: 1 (560)
  • I561: 1 (561)
  • I562: 1 (562)
GRAPHICS.DAT CSB X68000
  • IMG1: 674 (0-20, 22-670, 728-731). Empty Image 16x4: 22. Empty image 16x13: 1, 80-85, 126-245, 371-378. Empty Image 8x6: 258. Empty Image 3x3: 600-602, 649, 669
  • COD2: 3 (21, 676, 686)
  • SND4: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT2: 1 (694)
  • FNT1: 1 (695)
  • LAY1: 1 (696)
  • RAW2: 15 (713-727)
  • NULL: 4 (697-700)
GRAPHICS.DAT DM PC-9801 v2.0 Japanese
  • IMG2: 532 (0-20, 22-532). Empty images 16x4: 22, 24.
  • COD2: 3 (21, 538, 548)
  • SND2: 12 (563-574)
  • SND3: 21 (533-537, 539-547, 549-555)
  • TXT2: 1 (556)
  • FNT1: 1 (557)
  • NULL: 5 (558-562)
GRAPHICS.DAT DM FM-Towns 2.0 English, Japanese
  • IMG2: 532 (0-20, 22-532). Empty images 16x4: 22, 24. Empty images 16x9: 538, 548.
  • COD2: 3 (21, 538, 548)
  • SND2: 33 (533-537, 539-547, 549-555, 563-574)
  • TXT1: 1 (556)
  • FNT1: 1 (557)
  • NULL: 5 (558-562)
GRAPHICS.DAT CSB PC-9801 v3.1 Japanese
  • IMG2: 670 (0-20, 22-670). Empty Image 16x4: 22. Empty image 16x13: 80-85, 126-245, 371-378. Empty Image 8x6: 258. Empty Image 3x3: 600-602, 649, 669.
  • COD3: 3 (21, 676, 686)
  • SND3: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT2: 1 (694)
  • FNT1: 1 (695)
  • NULL: 4 (697-700)
  • LAY1: 1 (696)
  • RAW2: 15 (713-727)
GRAPHICS.DAT CSB FM-Towns 3.1 English, Japanese
  • IMG2: 670 (0-20, 22-670). Empty Image 16x4: 22. Empty image 16x13: 80-85, 126-245, 371-378. Empty Image 3x3: 600-602, 649, 669.
  • COD3: 3 (21, 676, 686)
  • SND3: 33 (671-675, 677-685, 687-693, 701-712)
  • TXT1: 1 (694)
  • FNT1: 1 (695)
  • NULL: 4 (697-700)
  • LAY1: 1 (696)
  • RAW2: 15 (713-727)
GRAPHICS.DAT DMII PC English
  • IMG3: 809 (Please see .map file for the list of items)
  • SND6: 107 (167-173, 426, 453, 459, 466, 468, 550, 1062-1063, 1934, 1951, 1956, 1958-1960, 1985, 1990, 2011, 2016, 2056, 2384, 2396, 2402, 2476, 2507, 2611, 2737, 2873, 2991, 3051, 3065, 3139, 3170, 3313-3314, 3345, 3419-3420, 3433-3435, 3507, 3513-3516, 3642-3643, 3654, 3705-3706, 3726, 3880, 3938, 3947, 4051, 4058-4060, 4119-4123, 4179-4180, 4188, 4314-4315, 4320, 4378-4379, 4389, 4547, 4548, 4560, 4597-4598, 4711-4712, 4797, 4855-4856, 4888, 5021, 5114, 5181, 5223-5224, 5247, 5328, 5392-5394, 5423-5424, 5434, 5466, 5479, 5586-5587)
  • MUS2: 29 (5595-5623)
  • TXT2: 1 (2)
  • FNT1: 1 (203)
  • RAW1: All other items
GRAPHICS.DAT DMII PC French
  • IMG3: 809 (Please see .map file for the list of items)
  • SND6: 105 (177-183, 438, 465, 471, 478, 480, 562, 1075-1076, 1946, 1963, 1968, 1970-1972, 1997, 2002, 2023, 2028, 2068, 2396, 2408, 2414, 2488, 2519, 2623, 2749, 2885, 3003, 3063, 3077, 3151, 3182, 3325-3326, 3357, 3431-3432, 3445-3447, 3519, 3525-3528, 3654-3655, 3666, 3717-3718, 3738, 3892, 3950, 3959, 4063, 4070-4072, 4131-4135, 4191-4192, 4200, 4326-4327, 4332, 4390-4391, 4401, 4559-4560, 4572, 4609-4610, 4723-4724, 4809, 4867-4868, 4900, 5033, 5126, 5193, 5235-5236, 5259, 5340, 5404-5406, 5435-5436, 5446, 5478, 5491)
  • MUS2: 29 (5607-5635)
  • TXT2: 1 (2)
  • FNT1: 1 (215)
  • RAW1: All other items
GRAPHICS.DAT DMII PC Demo
  • IMG3: 642 (Please see .map file for the list of items)
  • SND6: 55 (167-170, 370, 397, 403, 410, 412, 494, 1006-1007, 1878, 1895, 1900, 1902-1904, 1929, 1934, 1955, 1960, 2000, 2245, 2253, 2317, 2448, 2478, 2533-2534, 2550, 2624-2625, 2638-2640, 2712, 2718-2719, 2840, 2871-2872, 2877, 2938-2939, 2949, 3043-3044, 3105-3106, 3126-3127, 3185-3186, 3220)
  • MUS2: 6 (3326-3331)
  • TXT2: 1 (2)
  • FNT1: 1 (201)
  • RAW1: All other items
GRAPHICS.DAT DMII Amiga
  • SND5: 107 (182-206, 463, 484, 495, 497, 1942, 1947, 1973, 1978, 1999, 2004, 2403, 2489, 2496, 2556, 2589, 2785, 2907, 3000, 3057, 3137, 3193, 3245, 3327, 3397-3398, 3405, 3429, 3433, 3465, 3475, 3480, 3507, 3512, 3514, 3522, 3535-3537, 3661-3662, 3745, 3772, 3804, 3823, 3828, 3835-3836, 3841-3844, 3848, 3866-3867, 3881, 4027-4028, 4040, 4044-4045, 4104, 4170, 4178-4179, 4218, 4272, 4296, 4368, 4373-4374, 4415, 4427, 4441-4442, 4446, 4476-4477, 4489, 4527, 4541, 4614-4615)
  • TXT2: 1 (2)
  • FNT1: 1 (244)
  • RAW1: All other items
GRAPHICS.DAT DMII Macintosh
  • IMG4: 802 (Please see .map file for the list of items)
  • SND5: 107 (76-82, 271, 298, 304, 311, 313, 371, 676-677, 1255, 1264, 1269, 1271-1273, 1292, 1297, 1318, 1323, 1363, 1691, 1703, 1709, 1783, 1814, 1918, 2044, 2180, 2298, 2358, 2372, 2446, 2477, 2620-2621, 2652, 2726-2727, 2740-2742, 2814, 2820-2823, 2949-2950, 2961, 3012-3013, 3033, 3187, 3245, 3254, 3358, 3365-3367, 3426-3430, 3486-3487, 3495, 3621-3622, 3627, 3685-3686, 3696, 3854-3855, 3867, 3904-3905, 4018-4019, 4104, 4162-4163, 4195, 4328, 4421, 4488, 4530-4531, 4554, 4635, 4699-4701, 4730-4731, 4741, 4773, 4786, 4893-4894)
  • TXT2: 1 (2)
  • FNT1: 1 (115)
  • RAW1: All other items
GRAPHICS.DAT DMII Sega CD
  • SND7: 52 (31-52, 264, 577-578, 1533, 1615, 1711, 1888, 1990, 2079, 2196, 2257, 2309, 2442, 2446, 2465, 2485, 2520, 2551, 2577, 2680, 2708, 2791, 2800, 2925, 2926, 3066, 3071, 3091, 3128, 3142)
  • FNT1: 1 (94)
  • RAW1: All other items
HCSB.DAT CSB Amiga English R1 RX and Atari ST v2.0
  • IMG1: 2 (1-2)
  • P4B1: 1 (3)
  • RAW1: 1 (0)
HCSB.DAT CSB Amiga English Release 2 and 3
  • IMG1: 2 (1-2)
  • TXT2: 1 (4)
  • P4B1: 1 (3)
  • RAW1: 1 (0)
HCSB.DAT CSB Amiga French Release
  • IMG1: 2 (1-2)
  • TXT2: 1 (4)
  • P4B1: 1 (3)
  • RAW1: 1 (0)
HCSB.DAT CSB Amiga German Release
  • IMG1: 2 (1-2)
  • TXT2: 1 (4)
  • P4B1: 1 (3)
  • RAW1: 1 (0)
ANIMATE.DAT CSB Atari ST
  • IMG1: 17 (30-36, 75-84)
  • SND1: 2 (85-86)
  • P4B1: 68 (0-29, 37-74)
NAKED.AMG CSB Amiga Utility Disk English
  • SEQ1: 1 (0)
  • SND2: 5 (1-5)
NAKED.AMG CSB Amiga Utility Disk French and German
  • SEQ1: 1 (0)
  • SND2: 5 (1-5)
SONG.DAT DM PC v3.4
  • SEQ2: 1 (0)
  • SND8: 9 (1-9)

Item data formats

IMG1 and IMG2 data

IMG1 and IMG2 items contain images. The only difference between these two formats is the endian of the first two words that define the size of the image:

Header
  • 1 word (IMG1: big endian, IMG2: little endian): Image width in pixels
  • 1 word (IMG1: big endian, IMG2: little endian): Image height in pixels
Data

IMG1 and IMG2 data is used to store 16 colors images compressed with some sort of RLE algorithm (Run Length Encoding). The data is divided in nibbles (4 bits). Nibbles are grouped into blocks of variable length (at least 2 and always an even number). Each block defines a set of pixels to add to the image.

The image is considered as a single sequence of pixels starting at the top left corner of the image and going line by line to the bottom right corner.

Here is the algorithm to decode a block:
Read two nibbles: Nibble1 and Nibble2

Depending on the hexadecimal value of Nibble1, several cases are possible:

  • 0, 1, 2, 3, 4, 5, 6, 7: Add 'Nibble1 + 1' pixels of the color specified in Nibble2.
  • 8: Read the next byte (2 nibbles) in Byte1. Add 'Byte1 + 1' pixels of the color specified in Nibble2.
  • C: Read the next word (4 nibbles) in Word1. Add 'Word1 + 1' pixels of the color specified in Nibble2.
  • B: Read the next byte (2 nibbles) in Byte1. Add 'Byte1 + 1' pixels by copying pixels from the previous line of the image (position of current pixel minus width of image). Then add one pixel of the color specified in Nibble2.
  • F: Read the next word (4 nibbles) in Word1. Add 'Word1 + 1' pixels by copying pixels from the previous line of the image (position of current pixel minus width of image). Then add one pixel of the color specified in Nibble2.
  • 9: Read the next byte (2 nibbles) in Byte1.
    If Byte1 is even,
    • Add one pixel of the color specified in Nibble2.
    • Add 'Byte1' pixels by reading a nibble (color) for each pixel.

    If Byte1 is odd,

    • Nibble2 is equal to 0 and is ignored.
    • Add 'Byte1 + 1' pixels by reading a nibble (color) for each pixel.
  • D: (similar to 9): Read the next 2 bytes (4 nibbles) in Word1.
    If Word1 is even,
    • Add one pixel of the color specified in Nibble2.
    • Add 'Word1' pixels by reading a nibble (color) for each pixel.

    If Word1 is odd,

    • Nibble2 is equal to 0 and is ignored.
    • Add 'Word1 + 1' pixels by reading a nibble (color) for each pixel.
  • A: Add 'Nibble2 + 1' transparent pixels (only used in DL items in animation files)
  • E: Transparent pixels (only used in DL items in animation files)
    Depending on the hexadecimal value of Nibble2, several cases are possible:
    • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C: Add 'Nibble2 + 17' transparent pixels.
    • D: Read the next byte (2 nibbles) in Byte1. Add 'Byte1 + 1' transparent pixels.
    • E: Read the next byte (2 nibbles) in Byte1. Add 'Byte1 + 257' transparent pixels.
    • F: Read the next word (4 nibbles) in Word1. Add 'Word1 + 1' transparent pixels.

IMG3 and IMG4 data

IMG3 and IMG4 items contain images. The only difference between these two formats is the endian of the first two words that define the size of the image:

Header
  • 1 word (IMG3: little endian, IMG4: big endian): Image width in pixels
  • 1 word (IMG3: little endian, IMG4: big endian): Image height in pixels
  • 6 nibbles (3 bytes): Local palette of 6 most used colors in image
Data

IMG3 and IMG4 data is used to store 16 colors images compressed with some sort of RLE algorithm (Run Length Encoding). The data is divided in nibbles (4 bits). Nibbles are grouped into blocks of variable length (between 1 and 9 nibbles). Each block defines a set of pixels to add to the image and is made of:

  • A 'Control nibble' used to define what pixel(s) must be added to the image.
  • An optional 'Color nibble' used for colors that are not in the local palette of the image.
  • An optional set of 1, 3 or 7 nibbles used to specify a number of pixels to add to the image.

The image is considered as a single sequence of pixels starting at the top left corner of the image and going line by line to the bottom right corner.

Here is the algorithm to decode a block:
Read the 'Control' nibble. This nibble specifies what to add to the image:

  • Bit 3: (most significant bit)
    • '0': One pixel to add
    • '1': Several pixels to add
  • Bits 2-0: Color of the pixel(s) to add
    • '000' to '101' (0 to 5): Index of color in the local palette from the IMG3 header
    • '110' (6): Copy pixels from the previous line of the image
    • '111' (7): Absolute color. In that case, the 'Color nibble' which specifies the color number must be read.

Determine how many pixels to add to the image:

If Bit 3 of the 'Control' nibble is set to 1, the number of pixels to add is specified in the next 1, 3 or 7 nibbles (called nibble1, nibble2, etc...). Use the following algorithm to get this number:

Read Nibble1
If Nibble1 < 0Fh then
	NumberOfPixels = Nibble1 + 2
Else
	Read Nibble2 and Nibble3
	If Nibble2 * 16 + Nibble3 < FFh then
		NumberOfPixels = Nibble2 * 16 + Nibble3 + 17
	Else
		Read Nibble4, Nibble5, Nibble6 and Nibble7
		NumberOfPixels = Nibble4 * 4096 + Nibble5 * 256 + Nibble6 * 16 + Nibble7
	End If
End If

IMG5 data

IMG5 items contain images. This item format is used in Dungeon Master for Amiga 2.0 in the Swoosh file. There is no header.

Data

IMG5 data is used to store 16 colors images decompressed in planar format. There are 4 planes stored one after the other.
In each plane, there is one bit for each pixel of the whole image, so each byte contains a bit for 8 pixels. The most significant bit of each byte is for the first pixel.
Each pixel is a color index in a 16 colors palette which is not part of the image data. The most significant bit of each pixel is located in the first plane, the next bit in the next plane, etc. and the less significant bit is located on the last plane.
Pixels are decoded from left to right and top to bottom of the image.

IMG6 data

IMG6 items contain images. These items are used in Dungeon Master II for FM-Towns.

Header
  • 1 word: word1
  • 1 word: word2. word2 & 0xFE00 must be equal to 0x8000. (this can be used to detect if an image is compressed or decompressed in Dungeon Master II for FM-Towns).
  • 1 word: Image width in pixels
  • 1 word: Image height in pixels
Data

IMG6 data is used to store 16 colors images decompressed. The size of data for each image line must be a multiple of 16 bytes. Bytes with value 00 are used for padding if the image size if not a multiple of 32 pixels.
Each nibble of data represents a pixel. The most significant nibble of each byte is the first pixel.

Example:
If an image has a width of 83 pixels, you will need 83 / 2 = 42 bytes to store the data (2 pixels per byte). The last nibble is unused because the number of pixels if odd.
In order to achieve the mandatory 16 bytes alignment, you need to round up to the next multiple of 16, which is 48 bytes of data per line. When reading this data, you have to ignore the last 6.5 bytes of padding at the end of useful data.

IMG7 and IMG8 data

IMG7 and IMG8 items contain images. The only difference between these two formats is the endian of the first two words that define the size of the image.
These items share the same format as IMG3 and IMG4 items, except for the size of the local palette which is only 5 nibbles instead of 6. These items are used in some Dungeon Master II versions (like PC version) for overlay images only (base images do not use these formats). An overlay image is always combined (using transparency) with an base image and optionally with other overlay images in order to produce a final image. You can consider a base image as a complete image. An overlay image only contains differences from a base image.

Header
  • 1 word (IMG7: little endian, IMG8: big endian): Image width in pixels
  • 1 word (IMG7: little endian, IMG8: big endian): Image height in pixels
  • 5 nibbles (two and a half bytes): Local palette of 5 most used colors in image
Data

IMG7 and IMG8 data is identical to IMG3 and IMG4 data, check the IMG3 and IMG4 section for details.
The only differences are:

  • If a command nibble specifies to use local palette index 5 then the corresponding pixels are transparent (the pixels from the base image are visible).
  • If a "Copy pixels from previous line" command is used, then pixels from the previous line of the composed image (base + overlay with transparency) should be copied.

IMG9 data

This item format is described by kentaro-k.21 in Technical Documentation - Dungeon Master II Graphics.dat: How to read and decompress images from the PC version.

SND1 data

This sound format is used in the Atari ST versions of Dungeon Master and Chaos Strikes Back.

Header
  • 1 word (big endian): Number of sound samples
Data

The sound is encoded as PCM, 4 bit, mono, unsigned and is compressed with an RLE algorithm. Here is how to decode these sounds:

  • Read Nibble
  • If Nibble <> 0 Then Sample = Nibble
  • If Nibble = 0 Then
    • The previously read sample has to be repeated a certain number of times called RepeatCount. That number must be 3 at minimum. The value of RepeatCount is encoded in a variable number of nibbles, each of them containing 3 bits of the binary representation of RepeatCount as their less significant bits. The most significant bit is set to 1 in each of these nibbles except in the last nibble used to store the RepeatCount value which is marking the end of the cyle.
    • So each time you read a nibble for RepeatCount, you have to shift the bits of RepeatCount by three bits to the left and insert the three less significant bits of the last read nibble to the right until the most significant bit of the last read nibble is 0. You then need to add 3 to RepeatCount and copy the last sample read RepeatCount times.

Repeat that process until there are no more nibbles to read

Note: if you want to convert the sound data to PCM 8 bit sound, you need to multiply each sample value by 17 (the maximum nibble value is 15 which multiplied by 17 gives 255, the maximum 8 bit value).

Playback frequency of Entrance door sound: 2.4576 MHz / (4 * 145) = 4237 Hz
Playback frequency of all other sounds: 2.4576 / (4 * 112) = 5486 Hz

In order to play digital sounds, the game engine programs Timer A of the MK68901 MFP chip so that an interrupt is triggered periodically.
A new sound sample is played during each interrupt until the sound playback is complete and the interrupt is disabled.
While the MFT chip itself is clocked at 4 MHz, it has a separate clock source for the reference signal used by the timers: a 2.4576 MHz crystal.
The game configures Timer A in the following way:
The Timer A control byte is set to $01 which means that it will work in delay mode and with prescaler = 4.
When the sound of the opening dungeon doors is played on the main screen (where you choose Prison / Resume), the Timer A data byte is set to 145 ($91).
When any other sound in the game is played, the Timer A data byte is set to 112 ($70).

If you listen carefully to the original game, you will notice that the door sound is not played at the same speed for the entrance door and for doors when playing in the dungeon.
Also, there is no difference in sound playback frequency between a US (NTSC) and European (PAL) Atari ST computers.

SND2 data

Header
  • 1 word (big endian): Number of sound samples
Data
  • Sound data encoded as PCM, 8 bit, mono, signed (1 byte for each sound sample)
  • At the end, 0 to 3 bytes (unknown use)

Playback rate: the playback rate is not the same for all SND2 items in all versions. Moreover, in Amiga versions, the exact sample rate is different on PAL (Europe) and NTSC (US) machines because the sound clock is based on the CPU clock which is different in PAL (7093790 Hz) and NTSC (7159090 Hz).
The game does not define the frequency but the period for the sound chip. The sample rate is (CPUclock / (2 * period)).
With a period of 334 (014Eh, used in the swoosh program in DM Amiga v2.x), the sample rate is:
PAL: (7093790/2) / 334 = 10619 Hz
NTSC: (7159090/2) / 334 = 10717 Hz
Each sound in the game is defined with a playback speed value (one byte). The period configured on the sound chip is set to: 72800 / playback speed.
With a playback speed of 112 (used for sound items 533-537, 539-547, 550-555, 572 in DM Amiga v2.x), the sample rate is:
PAL: (7093790/2) / (72800 / 112) = 5457 Hz
NTSC: (7159090/2) / (72800 / 112) = 5507 Hz
With a playback speed of 138 (used for sound items 549, 563-571, 573 in DM Amiga v2.x), the sample rate is:
PAL: (7093790/2) / (72800 / 138) = 6718 Hz
NTSC: (7159090/2) / (72800 / 138) = 6779 Hz
With a playback speed of 150 (used for sound item 574 in DM Amiga v2.x), the sample rate is:
PAL: (7093790/2) / (72800 / 150) = 7313 Hz
NTSC: (7159090/2) / (72800 / 150) = 7381 Hz

SND3 data

Header
  • 1 word (big endian): Number of sound samples
Data
  • Sound data encoded as PCM, 8 bit, mono, unsigned (1 byte for each sound sample)
  • At the end, 0 to 3 bytes (unknown use)

Playback rate: around 6000 Hz.

SND4 data

This sound format is used in the X68000 versions of Dungeon Master and Chaos Strikes Back.

You can open these sounds with Goldwave (as Telephony / Dialogic 4 bit VOX ADPCM mono).

Playback rate: around 7812.5 Hz.

If you want to decode these items, you need to read the detailed technical information about the Dialogic ADPCM Algorithm.

SND5 and SND6 data

The SND5 sound format is used in the Amiga version of Dungeon Master II. The SND6 sound format is used in the PC versions of Dungeon Master II. The only difference between these two formats is the endian of the first word of data.

Header
  • 1 word (SND5: big endian, SND6: little endian): 2B77h (11127) Frequency (Hz)
  • 1 byte: Bits per sample: 08h
  • 1 byte: Number of channels: 01h
Data
  • Sound data encoded as PCM, 8 bit, mono, signed (1 byte for each sound sample)

Playback rate: 11127 Hz (or maybe 11025 Hz which is more standard).

SND7 data

This sound format is used in the Sega CD version of Dungeon Master II.

Header
  • 1 word (big endian): Total size of item (including this word)
Data
  • Sound data encoded as PCM, 8 bit, mono, signed (1 byte for each sound sample)

Playback rate: around 6000 Hz.

SND8 data

This sound format is used in the PC version of Dungeon Master, in the SONG.DAT file.

Header
  • 1 word (big endian): Number of sound samples
Data

Playback rate: 11025 Hz.

The sound data is encoded in a sort of DPCM (Differential PCM). Each signed nibble of data specifies the difference between the previous sample and the next one. There is one special nibble value (-8) which specifies that the sample difference is encoded in the next two nibbles (as a signed byte). Here is how to decode these sounds:

Read Nibble1 (the value is 0 to 15)
If Nibble1 > 7 Then Nibble1 = Nibble1 - 16
If Nibble1 <> -8 Then
	Difference = Nibble1
Else
	Read two more nibbles, Nibble2 and Nibble3
	Difference = Nibble2 * 16 + Nibble3
	If Difference > 127 Then Difference = Difference - 256
End If
Sample = PreviousSample + Difference

Repeat that process until there are no more nibbles to read

SND9 data

This sound format is used in the FM-Towns version of Dungeon Master II.

Header
  • 1 word (little endian): Total size of item (including this word)
Data
  • Sound data encoded as PCM, 8 bit, mono, unsigned (1 byte for each sound sample)

Playback rate: around 6000 Hz.

SNDA data

This sound format is used in the IBM PS/V version of Dungeon Master II.

Header
  • 1 word (little endian): Total size of item (including this word)
Data
  • Sound data encoded as PCM, 8 bit, mono, signed (1 byte for each sound sample)

Playback rate: around 6000 Hz.

MUS1 data

MUS1 data contains a standard MIDI file.

FNT1 data

FNT1 data contains a picture of 1 line of 128 characters of 5 pixels width and 6 pixels height. The three most significant bits of each byte of FNT1 data are not used and set to 0. The other 5 bits define one line of a character.

The first 128 bytes of data represent the first line of each character. The next 128 bytes are for the second line, and so on until the end of the data.

TXT1 data

TXT1 data contains strings of 7 bit ASCII characters. Bit 7 (most significant bit) of each byte is always set to 0, except for the last character of each string which is marked with bit 7 set to 1.

TXT2 data

TXT2 data contains strings of 8 bit ASCII characters. Each string is terminated by a 00h byte.

TXT3 data

This item format is described by kentaro-k.21 in Technical Documentation - Dungeon Master II Graphics.dat: How to read the Text data.

P4B1 data

P4B1 data contains a 16 colors (4 bits) palette. It is used in ANIMATE.DAT CSB Atari ST 2.0 and in the HCSB.DAT files.
Each P4B1 item consists of 32 bytes. There are 16 big endian words (one for each color). In each word, the first nibble (most significant) is always set to 0.
The other three nibbles specify respectively the red, green and blue levels (values range from 0 to 7, the most significant bit of each nibble is ignored).

Example: If a word has the value 0426h, then the color is like this:

  • Red: 4
  • Green: 2
  • Blue: 6

SEQ1 data

SEQ1 data contains a sequence of music parts to be played, like a simple music score.
It consists of a list of bytes containing the music parts numbers (index of music parts in the data file). At the end of the list, two FFh bytes mark the end of the sequence. The music then loops indefinitely from beginning to end.

SEQ2 data

SEQ2 data contains a sequence of music parts to be played, like a simple music score.
It consists of a list of little endian words containing the music parts numbers (index of music parts in the data file). The last word in the list has bit 15 set to 1 to mark the end of the sequence. The music then loops indefinitely from beginning to end.

COD1 data

This item type is used in Dungeon Master and Chaos Strikes Back for Atari ST.
This is machine code for the 68000 processor (the processor in Atari ST) hidden as IMG1 graphics. This is used by the game's copy protection system.
In order to decode these items, the IMG1 algorithm must be used, but afterwards, the resulting bitmap data must be converted to the planar format used by the graphics chip on the Atari ST. The resulting binary data is the hidden executable code.
When the game engine decodes an IMG1 item, it produces the planar format directly.
See Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Hidden code

COD2 data

This item type is used in Dungeon Master and Chaos Strikes Back for Amiga, Dungeon Master and Chaos Strikes Back for X68000, Dungeon Master for FM-Towns and Dungeon Master for PC-9801.
This is machine code for the 68000 processor (the processor in Amiga) hidden as IMG1 graphics. This is used by the game's copy protection system.
As the code in these items is for the Amiga versions, the items found in X68000, FM-Towns and PC-9801 are probably unused leftovers from the porting of the game to these platforms.
COD2 items are decoded in the same way as COD1, but the resulting words need reordering to separate bitplanes:
Bitplane 0 consists of: 1st, 5th, 9th, etc. words
Bitplane 1 consists of: 2nd, 6th, 10th, etc. words
Bitplane 2 consists of: 3rd, 7th, 11th, etc. words
Bitplane 3 consists of: 4th, 8th, 12th, etc. words
See Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Hidden code

COD3 data

This item type is used in Chaos Strikes Back for FM-Towns and Chaos Strikes Back for PC-9801.
This is machine code for the 68000 processor (the processor in Amiga) hidden as IMG2 graphics. This is used by the game's copy protection system.
As the code in these items is for the Amiga versions, these items are probably unused leftovers from the porting of the game to these platforms.
COD3 items are decoded in the same way as COD2, the only difference is that the dimensions of the image are in little endian (IMG2) instead of big endian (IMG1).
See Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Hidden code

COD4 data

This item type is used in Dungeon Master for Apple IIGS.
This is machine code for the 65C816 processor (the processor in Apple IIGS) hidden as IMG1 graphics. This is used by the game's copy protection system.
COD4 items are decoded in the same way as IMG1 items, but without any final reordering of bytes to produce a .bmp file. The resulting data directly represents the machine code.
See Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Hidden code

I558 data

This item type contains binary data. The detailed structure is documented on Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 558 (Coordinates).

I559 data

This item type contains binary data. The detailed structure is documented on Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 559.

I560 data

This item type contains binary data. The detailed structure is documented on Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 560 (Actions and spells).

I561 data

This item type contains binary data. The detailed structure is documented on Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 561 (Keyboard and mouse input).

I562 data

This item type contains binary data. The detailed structure is documented on Technical Documentation - Dungeon Master and Chaos Strikes Back Graphics.dat: Item 562.

LAY1 data

This item type contains graphics layout information like sizes and coordinates. The detailed structure is documented on Technical Documentation - File Formats - LAY1 items (Item 696, DMCOORD.DAT, DMII type 4 entries).

RAW1 data

This data type is attributed to items that are not yet decoded (unknown content).

RAW2 data

This data type is attributed to items that do not contain anything to decode.

NULL data

This data type is attributed to items that have no data at all (they are just listed in the header part with a size equal to 0).

ENT1

This data type contains a list of entries describing the contents of the graphics.dat file. This data type is used in Dungeon Master II only.

Header
  • 1 word: Magic number: 8001h
  • 1 word: Number of entries
  • 16 bytes: Unknown. These 16 bytes are identical in all versions of the game: 00 07 54 01 49 01 44 01 53 01 46 01 47 01 80 02.
Data

The data is a sequence of entries which number is specified in the header. Each entry consists of 8 bytes:

  • 1 byte: Entry category
    • 00: Technical Data (Image composition, Tool Version)
    • 01: Interface - Main Screen
    • 03: Messages
    • 04: Music
    • 05: Main Menu and Credits
    • 06: Credits
    • 07: Interface - Character Sheet
    • 08: Dungeon Graphics
    • 09: Wall Decorations
    • 0A: Floor Decorations
    • 0B: Door Decorations
    • 0C: Door Buttons
    • 0D: Missiles
    • 0E: Doors
    • 0F: Creatures
    • 10: Weapons
    • 11: Armor
    • 12: Scrolls
    • 13: Potions
    • 14: Containers
    • 15: Miscellaneous
    • 16: Champions
    • 17: Skullkeep and Weather
    • 18: Teleporter
    • 1A: Dialog boxes
    • 1C: Japanese Fonts
  • 1 byte: Entry index. In a given category, each entry has a unique index.
  • 1 byte: Entry type
    • 00: Copyright, date, version. There is only one entry of this type (entry 00 01 00 00 00 FE) in these versions: Amiga, Macintosh, Macintosh Demo, PC Demo, PC English, PC French, PC German. This entry type is not used in other versions.
    • 01: Image. This entry type is used in all versions.
    • 02: Sound. This entry type is used in all versions.
    • 03: Music. This entry type is used in the following versions: PC Demo, PC English, PC French, PC German.
    • 04: Rectangles structure. There is exactly one entry of this type (entry 01 00 04 00 00 00) in all versions except in version PC 0.9 Beta where this entry type is not used (the equivalent item is stored in a separate file DMCOORD.DAT). See Technical Documentation - File Formats - LAY1 items (Item 696, DMCOORD.DAT, DMII type 4 entries)
    • 05: Text. This entry type is used in all versions.
    • 06: ??? There is only one entry of this type (entry 01 00 06 xx xx xx) in these versions: FM-Towns, IBM PSV, Macintosh JP, PC-9801 JP, PC-9821, Sega CD EN, Sega CD JP. Probably creature animations data because in other versions where there is no such type 6 entry, there are additional type 7 and type 8 entries associated to each creature.
      There is also a single entry of this type in these versions: Macintosh, Macintosh Demo. It contains the marble user interface image unique to the Macintosh version (See the 'Normal Layout' screenshots on Dungeon Master II for Macintosh). This image is compressed with an LZW algorithm, an 8 bytes header similar to the one described on Technical Documentation - Dungeon Master II Graphics.dat: How to read and decompress images from the PC version specifies the image size (big endian, 512x384 pixels, height has +7Ch) and compression scheme #1.
      This entry type is not used in other versions.
    • 07: Raw binary data. This entry type is used in all versions.
    • 08: Raw binary data. This entry type is used in all versions.
    • 09: Palettes. This entry type is used in all versions.
    • 0B: Word (2 bytes). This entry type is used in all versions.
    • 0C: Image offset (2 bytes). This entry type is used in all versions.
    • 0D: Palette (16 bytes). There is only one entry of this type (entry 01 00 0D FE 08 FF) in these versions: IBM PSV, Macintosh, Macintosh Demo, Macintosh JP, PC Demo, PC English, PC French, PC German, PC-9801 JP, PC-9821. There are 2620 entries of this type in version PC 0.9 Beta. This entry type is not used in other versions.
    • 0E: Raw binary data. This entry type is used in all versions except Macintosh Demo, PC Demo, PC 0.9 Beta.
  • 3 bytes: Entry name. In a given category and index, each entry has a unique name.
    Some examples for items categories (Weapons, Armor, Scrolls, Potions, Containers, Miscellaneous), type 0B:
    • 00 00 00: ??
    • 01 00 00: Weight in Kg (x10)
    • 01 F0 00: ??
    • 02 00 00: Money value
    • 02 F0 00: ??
    • 03 00 00: Food value
    • 04 00 00: Equip, Portability
    • 05 00 00: ??
    • 06 00 00: Icon anim
    • 08 00 00: Attack strength
    • 09 00 00: Throw strength
    • 0A 00 00: Accuracy
    • 0B 00 00: Armor / Sharp resistance. There are 4 items (Foot Plate, Ra Sar Plate, Ra Sar Shield, Fire Greave) that do not have this value but instead have value "0B 01 00" with exactly the same content (two bytes, one for armor, the other for sharp resistance).
      The Sharp resistance byte has two parts:
      • Least significant nibble: Sharp resistance value (from 0 to 7)
      • Most significant nibble: if most significant bit (bit3) equals 1 (nibble = 8), then the item is ignored when calculating armor. This bit is set for shields and not for other items.
    • 0C 00 00: ??
    • 0D 00 00: ??
    • 12 00 00: ??
    • 13 00 00: ??
    • 14 00 00: Mana bonus
    • 15 00 00: ??
    • 16 00 00: Strenght bonus
    • 17 00 00: Dexterity bonus
    • 18 00 00: Wisdom bonus
    • 19 00 00: Vitality bonus
    • 1A 00 00: Anti-Magic bonus
    • 1B 00 00: Anti-Fire bonus
    • 1E 00 00: Fighter skill bonus
    • 1F 00 00: Ninja skill bonus??
    • 20 00 00: Priest skill bonus. Signed value. Sar Shield removes one priest level, the value is 00 FF. The last byte is the bonus value (signed byte: here FF means -1).
    • 21 00 00: Wizard skill bonus
    • 22 00 00: ??
    • 23 00 00: ??
    • 24 00 00: ??
    • 26 00 00: ??
    • 27 00 00: ??
    • 2B 00 00: ??
    • 2C 00 00: ??
    • 2E 00 00: ??
    • 2F 00 00: ??
    • 30 00 00: ??
    • 31 00 00: ??
    • 32 00 00: ??
    • 33 00 00: ??
    • 34 00 00: Max charge count
    • 35 00 00: Additional money value per charge?

    Note: Depending on the value, a bonus may be permanent or temporary. It may apply when holding an item or after using/eating the item.

  • 1 word: Entry data.
    For 0B entries the entry data is the word value stored as little endian or big endian depending on the platform.
    For 0C entries the entry data is the value of the image offset.
    For other entries it is the item number in the graphics.dat file, always stored as big endian.
    Note: Some images only contain the differences from a base image. Both images must be decoded to render the final images. Check Technical Documentation - Dungeon Master II Graphics.dat: How to read some messed up images for details.

Dungeon Master II Champion statistics

In Dungeon Master II for PC 0.9 Beta champion statistics are stored in DUNGEON.DAT like for Dungeon Master and Chaos Strikes Back.
In all other versions of Dungeon Master II, champion statistics are stored in GRAPHICS.DAT. Each champion has a 52 bytes type 08 item (Raw binary data) storing the starting skills and statistics of the champion. In Dungeon Master II for PC, these are little endian values:

  • 1 word: Health
  • 1 word: Stamina (x10)
  • 1 word: Mana
  • 1 word: Luck
  • 1 word: Strength
  • 1 word: Dexterity
  • 1 word: Wisdom
  • 1 word: Vitality
  • 1 word: Anti-Magic
  • 1 word: Anti-Fire
  • 16 words: one word for each hidden skill

Dungeon Master II Containers

Money Box

The Money box item in graphics.dat has a text entry named 40 00 00 that contains: J26-28 J8 J56 J6.
This string defines which items can be stored in the Money Box. The letter "J" is for "Miscellaneous items" and the numbers are the indices of items that can be put in the money box:

  • 26: Blue Gem
  • 27: Red Gem
  • 28: Green Gem
  • 8: Gold Coin
  • 56: Silver Coin
  • 6: Copper Coin

Dungeon Master II for FM-Towns

In this version, images are encoded with IMG2 or IMG6 format. It is possible to determine which format is used for an image by testing the value of the second word of the header:
if (word2 & 0xfe00) == 0x8000 then the image is decompressed (IMG6 format)
if (word2 & 0xfe00) != 0x8000 then the image is compressed (IMG2 format)

Some images in the FM-Towns version use the transparent pixels capability of IMG2 format but there is no apparent reason for that: this version does not use base images and consequently there is no entry 00 00 08 00 00 00.

Single item Data Files

The following files contain only one item without any header.

  • TELE2.AMG CSB Amiga (SND2)
  • SWIPE.AMG CSB Amiga (SND2)
  • MAGEXPLO.AMG CSB Amiga (SND2)
  • EXPLOS1.AMG CSB Amiga (SND2)
  • ENTER.SNG CSB X68000 (MUS1)
  • DRAGON.AMG CSB Amiga (SND2)
  • CEDTLS.DAT CSB Amiga Utility Disk German (TXT2)
  • CEDTLS.DAT CSB Amiga Utility Disk French (TXT2)
  • CEDTLS.DAT CSB Amiga Utility Disk English R2 R3 (TXT2)
  • ENTER.SNG CSB PC-9801 (MUS1)

Special Thanks

I wish to thank Zyx (the developer of GraphReader), Brian (the developer of DMDecode) and Paul R. Stevens (developer of Chaos Strikes Back for Windows) as their source code helped me understand the image encodings.
I also wish to thank Kentaro.k-21 for his work on the Dungeon Master II graphics.dat file format as well as SND1 decoding.

History of this document

Version 1.9 - May 13, 2020
Added description of command D in IMG1/IMG2. Used only in items 1788, 1789, 1790 (Wall ornate #55h) and 2142, 2143, 2144 (Wall ornate #41h) of DM2 for FM-Towns GRAPHICS.DAT
Version 1.81 - January 22, 2010
Renamed item type I696 to LAY1 now that the content of these items is understood.
Version 1.8 - January 9, 2010
Added I696, COD2, COD3, COD4 data types. Updated descriptions of some graphics.dat files.
Version 1.7 - September 4, 2008
Added IMG9, TXT3, COD1, I558, I559, I560, I561, I562 data types. Added and updated descriptions of some graphics.dat files.
Version 1.6 - March 04, 2007
Added IMG5, IMG6, IMG7, IMG8 and SNDA data types, added more examples of entry names in ENT1 section, added notes about Dungeon Master II for FM-Towns.
Version 1.51 - February 24, 2007
Added description of entry type 0C and SND9 data type.
Version 1.5 - February 21, 2007
Added ENT1 data type and some more information about data in Dungeon Master II graphics.dat files.
Version 1.4 - February 17, 2007
Listed some more data files. Added a link about the ADPCM algorithm used by SND4 items.
Version 1.3 - January 14, 2007
Listed some more data files. Added MUS1 data type.
Version 1.2 - January 06, 2007
Added item size limitation to 32 KB supplied by Meynaf.
Version 1.2 - April 10, 2005
Updated information about SND1 (4 bit PCM sample values must be multiplied by 17 instead of 16 to convert to 8 bit PCM samples)
Added information about sample rates in SND2 section.
Added description for SND8 format used in SONG.DAT
Version 1.1 - May 14, 2004
Added SND1 details based on work from Kentaro.k-21
Version 1.0 - February 9, 2003
First release