Contents

Technical Documentation - Conventions

This page describes some basic concepts and definitions that are used throughout the technical documentation on this web site.
It is by no mean complete and only focuses on the aspects that are useful in the context of the Dungeon Master series of games.

Basic data

bit
A bit is the smallest unit of storage currently used in computing. It can have 2 values: 0 or 1.
nibble
A set of 4 bits. A nibble can have 2^4 = 16 possible values.
byte
A set of 8 bits. A byte can have 2^8 = 256 possible values.
word
A set of 16 bits. A word can have 2^16 = 65536 possible values.
dword
A set of 32 bits. A double word can have 2^32 = 4294967296 possible values.

Endianness

For basic data consisting of several bytes (words and dwords), there are two possible byte orders to store data. Each computer platform uses one of these two byte orders:

Big endian
This designates the byte order where the most significant byte is stored first. For example, the word with hexadecimal value 1A2B would be stored as 1A2B and the dword value 1A2B3C4D would be stored as 1A2B3C4D.
Little endian
This designates the byte order where the less significant byte is stored first. For example, the word with hexadecimal value 1A2B would be stored as 2B1A and the dword value 1A2B3C4D would be stored as 4D3C2B1A.

Graphics data

Bitmap graphics

In the Dungeon Master series of games, all graphics data is stored as bitmap graphics (also known as raster graphics) as opposed to vector graphics. It means that each graphics is made of a grid of pixels, each pixel having its own value.
The value of a pixel is an index in a color palette. The number of colors in the color palette determines the data size of each pixel in computer memory. For example, a 16 colors graphics requires that each pixel is coded on 4 bits. In that way, the 16 possible values of each pixel will refer to one of the 16 available colors in the palette. The following pixel sizes are found in the various versions of the games:

  • 1 bit: 2 colors palette
  • 2 bits: 4 colors palette
  • 4 bits: 16 colors palette
  • 8 bits: 256 colors palette

There are two usual ways to represent pixel data in memory or on disk: linear and planar. Note that there are some variants based on these two basic representations.

Linear
In linear representation, all the bits of data for each pixel are stored together. Data is stored for each pixel one after the other.
For example in a 16 colors graphics where each pixel is coded on 4 bits, each byte of data contains the representation of 2 pixels. The 4 most significant bits represent the first pixel, the other less significant 4 bits represent the second pixel.
Planar
In planar representation, pixel data is stored with several bitplanes. Each bitplane contains one bit of information for each pixel: one byte in one bitplane contains 1 bit of information for 8 pixels.
For example, a 16 colors graphics where each pixel is coded on 4 bits would be stored as 4 bitplanes of equal size. To obtain the value of each pixel, you need to get one bit of information from each of the 4 available bitplanes.

Tile based graphics

On some platforms, graphics are stored as tiles of small size like 8x8 pixels or 16x16 pixels. A background image or a sprite on the screen is made of many tiles assembled to create the full image. In such cases, the image is defined by three elements:

  • A color palette
  • A tileset: This is the set of tiles that can be used to create the image. Each tile is a bitmap graphics. In a tileset, the pixel data can use any number of bits as well as linear or planar representation.
  • A tilemap: This map specifies the list of tiles to display on screen. For each tile, the color palette can also be specified. For example on the Super NES, each color palette consists of 16 palettes of 16 colors each. The first 8 palettes can be used by backgrounds, the last 8 palettes can be used by sprites.