2 Universal Disk Image Format
ksherlock edited this page 2015-04-23 11:56:44 -04:00

Please refer to the documentation for any ambiguities.

Universal Disk Images (.2mg or .2img) consist of a 64-byte header followed by disk image data. An optional comment chunk and creator-specific chunk (in that order) may be present after the image data.

All values are stored in little endian format.

Name Offset Size
magic_code $00 4 bytes
creator_code $04 4 bytes
header_length $08 2 bytes
version $0a 2 bytes
format $0c 4 bytes
flags $10 4 bytes
blocks $14 4 bytes
data_offset $18 4 bytes
data_length $1c 4 bytes
comment_offset $20 4 bytes
comment_length $24 4 bytes
creator_offset $28 4 bytes
creator_length $2c 4 bytes
reserved $30 16 bytes

magic_code

This is the string '2IMG'.

creator_code

This is a four-character tag which identifies the file creator. Currently know values are:

Application Code
Bernie ][ the Rescue B2TR
Catakig CTKG
Sheppy's ImageMaker ShIm
Sweet 16 WOOF
ProFUSE PRFS

header_length

This is the length of the header. Although the documentation specifies 52 (which excludes reserved bytes), some files are known to use 64.

version

The version number of the image file. This should be 1.

image_format

The image data format. Valid values are:

Format Value
DOS 3.3 Order 0
ProDOS Order 1
Nibblized data 2

flags

Bit flags pertaining to the disk image. Undefined bits should be set to 0.

Bit Description
31 If this bit is set, the disk is locked.
8 If this bit is set, bits 0--7 are valid. If this bit is not set, a
volume number of 254 should be assumed
0--7 The DOS 3.3 volume number (0--254). Only valid if bit 8 is set

blocks

The number of 512-byte blocks in the disk image. For Non-ProDOS Order disk images, this field should be 0.

data_offset

Offset to the first byte of the image data. The image data must come before the comment data and the creator data (if present).

data_length

Length of the image data in bytes. For ProDOS Order disk image, this should be blocks * 512.

comment_offset

Offset to the first byte of the comment data. May be 0 if there is no comment.

comment_length

Length of the comment data. May be 0 if there is no comment.

creator_offset

Offset to the first byte of the creator-specific data. May be 0 if there is no creator-specific data.

creator_length

Length of the creator-specific data. May be 0 if there is no creator-specific data.