Skip to content

DM1 File Formats

Daniel Nylander edited this page Aug 1, 2026 · 1 revision

Dungeon Master File Formats

Dungeon Master PC 3.4 (DOS). All multi-byte values are little-endian (Watcom/Borland LSB-first bitfields).

DUNGEON.DAT — Dungeon Data

Field Value
Size ~33 KB
Byte order Little-endian
Dungeon ID 10 (DM)

Header (44 bytes)

Offset Size Field
0x00 2 Ornament random seed
0x02 2 Raw map data byte count
0x04 1 Map count
0x05 1 Reserved
0x06 2 Text data word count
0x08 2 Initial party location (packed: bits 11-10 = direction, 9-5 = Y, 4-0 = X)
0x0A 2 Square-first-thing count
0x0C 32 Thing counts (16 x uint16)

Map Descriptors (16 bytes each)

One descriptor per level, starting at offset 44:

Offset Size Field
0x00 2 Data offset
0x02 1 Width (stored as value-1)
0x03 1 Height (stored as value-1)
0x04 1 Floor ornament count
0x05 1 Wall ornament count
0x06 1 Difficulty
0x07 1 Creature type count
0x08 1 Door ornament count
0x09 1 Floor set selector
0x0A 1 Wall set selector
0x0B 1 Door set 0 selector
0x0C 1 Door set 1 selector
0x0D-0x0F 3 Reserved

Square Data (1 byte per cell)

Grid is stored column-major. Each byte encodes:

Bits Field
7-5 Element type (0=wall, 1=corridor, 2=pit, 3=stairs, 4=door, 5=teleporter, 6=fake wall)
4 Has thing list
3-0 Element-specific data

Thing Encoding (uint16)

Bits  15-14  Direction (0-3)
Bits  13-10  Type (0-15)
Bits   9-0   Index

Special values: 0xFFFF = THING_NONE, 0xFFFE = THING_ENDOFLIST.

Thing Record Sizes

Type Name Size (bytes)
0 Door 4
1 Teleporter 6
2 Text string 4
3 Sensor 8
4 Group 16
5 Weapon 4
6 Armour 4
7 Scroll 4
8 Potion 4
9 Container 8
10 Junk 4
13 Projectile 8
14 Explosion 4

Compression

On-disc data may be FTL-compressed (signature: 0x8104). The loader requires decompressed data. FTL decompression uses a 20-byte frequency table prefix. File identity is verified by content hash, not filename.

GRAPHICS.DAT — Game Graphics

Field Value
Size ~363 KB
Max bitmaps 600
Compression 12-bit LZW (GIF-style)

Bitmap Index

The file begins with a table of bitmap headers:

Field Size Description
Width 2 Bitmap width in pixels
Height 2 Bitmap height in pixels
Compressed size 4 LZW-compressed data size
Offset 4 File offset to compressed data

LZW Compression

Parameter Value
Clear code 256
End-of-info code 257
First variable code 258
Max code 4,096
Code width 9-12 bits (grows dynamically)
Bit order LSB-first

Pixel Format

  • 4 bitplanes for 16-color indexed pixels
  • Byte width per bitplane: (width + 7) / 8
  • Palette: 6-bit RGB per channel (0-63, Atari ST/Amiga style)
  • Framebuffer: 320x200 indexed

Save File Format

Field Value
Magic 0x444D0001 ("DM\0\1")
Header size 512 bytes
Encryption key index 10

The save header is encrypted. The body contains FTL-compressed dungeon data (signature 0x8104) plus champion state, timers, and game info. A per-part byte checksum (F7059/F7060) validates integrity.

FTL Container Format (Amiga/X68000/SegaCD)

Field Value
Magic 0x6160
Common header 20 bytes
Offset  Size  Description
0x00    2     Magic: 0x6160
0x02    2     Checksum
0x04    14    Reserved
0x12    2     Hunk count

Each hunk header is 12 bytes:

Offset Size Field
0x00 2 Type (0x0010=BSS, 0x0011=DATA, 0x0012=CODE)
0x02 2 Unknown
0x04 4 Offset
0x08 4 Size

Clone this wiki locally