DCM Format
Intel byte order

Information from File Format List 2.0 by Max Maischein.

--------!-CONTACT_INFO----------------------
If you notice any mistakes or omissions, please let me know!  It is only
with YOUR help that the list can continue to grow.  Please send
all changes to me rather than distributing a modified version of the list.

This file has been authored in the style of the INTERxxy.* file list
by Ralf Brown, and uses almost the same format.

Please read the file FILEFMTS.1ST before asking me any questions. You may find
that they have already been addressed.

         Max Maischein

Max Maischein, 2:244/1106.17
Max_Maischein@spam.fido.de
corion@informatik.uni-frankfurt.de
Corion on #coders@IRC
--------!-DISCLAIMER------------------------
DISCLAIMER:  THIS MATERIAL IS PROVIDED "AS IS".  I verify the information
contained in this list to the best of my ability, but I cannot be held
responsible for any problems caused by use or misuse of the information,
especially for those file formats foreign to the PC, like AMIGA or SUN file
formats. If an information it is marked "guesswork" or undocumented, you
should check it carefully to make sure your program will not break with
an unexpected value (and please let me know whether or not it works
the same way).

Information marked with "???" is known to be incomplete or guesswork.

Some file formats were not released by their creators, others are regarded
as proprietary, which means that if your programs deal with them, you might
be looking for trouble. I don't care about this.
--------------------------------------------

The DCM module format was designed by Winfried Welti, and is based on a
RIFF / IFF style format called WUFF - Welti's Universal File header Format.

The header for WUFF files is built much like the RIFF header :

OFFSET              Count TYPE   Description
0000h                   4 char   ID="WUFF"
0004h                   4 char   Subformat ID, see below
0008h                   1 dword  File length including the WUFF header
000Ch                   1 word   File format version as BCD.
                                 Bits 15-12 are flags :
                                    12 - Archive file. If set, the data after the
                                         header contains only WUFF style files.
                                 13-15 - reserved.
000Eh                   1 word   Length of subheader following this header.

The DCM format has a header ID of "DCMw" and a version word of 0100h. It extends
the header with the following values:

0010h                   1 word  Song flags, bitmapped
                                 0 - Samples present
                                 1 - Songdata present
                                 2 - Infotext present
                              3-15 - reserved
0012h                   1 word  Number of instruments

After the header, there follow the included (WUFF) files; Allowed fileformats
for include are : MDCw (Patterns), EDIw (Instrument), TXTw (Text); see below.

The MDC format is a module format which uses compiled pattern data. It has the
subformat ID "MDCw", the current version is 1.01, it extends the header with
the following fields :

OFFSET              Count TYPE   Description
0010h                   1 word   Flags for the song (see table 0011)
0012h                   1 word   Internal frequency for replay
0014h                   1 dword  Length of packed data channels
0028h                   1 byte   Number of used channels
  24 : Chnls   : Byte      Used Channels (0..chnls-1)

(Table 0011)
MDC song flags
   0 - Stereo enable
   1 - Free Frequency (can replay freq change in song ?)
 2-3 - Offset size  :
        00 - Byte (mod offsets, multiply by 256)
        01 - Word  (16 bit offsets)
        10 - DWord (32 bit offsets)
        11 - reserved
 4-5 - Panning range
        00 - GUS panning (4 bit, byte value)
        01 - 8 Bit panning
        10 - reserved
        11 - reserved
 6-7 - Instrument number range
        00 - Byte
        01 - Word
        10 - reserved
        11 - reserved
   8 - S3M compatibility bit (all ranges are like s3m : mod offsets,
                                  GUS panning, Ins Num Range : Byte)
   9 - Tuning control
         0 - Use Period values (word) (s3m)
         1 - Use Frequency values (Dword)
10-15- reserved

After the header, there comes the packed data for the module. This format
consists of one control byte and depending on the value some other data
bytes.

Values of control byte :
        0 - Next Frame
        1 - End of File
        2 - Order Num. follows [byte]
        3 - Loop to Ord Num (1 byte follows)
        4 - Frames to wait follows [byte]
        5 - New Replay freq follows [byte]
    6..31 - reserved

If the byte is greater than 31 then it has the following bitmapped format :

      0-4 - Channel Nr.
        5 - Key Byte follows
        6 - Period Value follows [word]
        7 - Volume Value follows [byte]

Key byte format, bitmapped :

        0 - Start Sample
        1 - Stop Sample
        2 - Instr Nr follows [byte/word/??]
        3 - Offset follows [byte/word/??]
        4 - Pan pos follows [byte/??]
      5-7 - reserved

The EDI format has an ID value of "EDIw" and a version of 0100h, and it extends
the header with the following information :

OFFSET              Count TYPE   Description
0010h                   1 word   Sample flags, bitmapped
                                 0-1 - Loop type
                                       00 - none
                                       01 - forward loop
                                       10 - bidirectional loop
                                       11 - reserved
                                   2 - 32 bit values for sample length etc., see below
                                   3 - Sample is 16 bit
                                   4 - Frequency is 32 bit.
                                5-15 - reserved
0012h                   1 word   C2 frequency of sample
0014h                   1 dword  Loop start, this may be a word, depending on
                                 the sample flags.
0018h                   1 dword  Loop end, see loop start
001Ch                   1 dword  Sample length

The song text is plain ASCII.
EXTENSION:DCM
OCCURENCES:PC
SEE ALSO:S3M
