Universal Disk Image Format

This is an old revision of this page, as edited by Thumperward (talk | contribs) at 11:51, 24 July 2011 (rm spam, tidy, tag). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Universal Disk Image Format (UDIF) is a computer [disk image]] format used on Mac OS X for Apple Disk Images. UDIF is a flat file format, and is the native image format for Mac OS X.

The format can also be opened by MagicISO and the freeware MagicDisc on Microsoft Windows.

The header can be described using the following C structure. All values are little-endian (Apple II byte ordering)

Position(in Hex) Length (in bytes) Description
000 4 The integer constant '2IMG'. This integer should be little-endian, so on the Apple IIgs, this is equivalent to the four characters 'GMI2'; in ORCA/C 2.1, you can use the integer constant '2IMG'.
004 4 A four-character tag identifying the application that created the file.
008 2 The length of this header, in bytes. Should be 52.
00A 2 The version number of the image file format. Should be 1.
00C 4 The image format.
010 4 Flags
014 4 The number of 512-byte blocks in the disk image. This value should be zero unless the image format is 1 (ProDOS order).
018 4 Offset to the first byte of the first block of the disk in the image file, from the beginning of the file. The disk data must come before the comment and creator-specific chunks.
01C 4 Length of the disk data in bytes. This should be the number of blocks * 512.
020 4 Offset to the first byte of the image comment. Can be zero if there's no comment. The comment must come after the data chunk, but before the creator-specific chunk. The comment, if it exists, should be raw text; no length byte or C-style null terminator byte is required (that's what the next field is for).
024 4 Length of the comment chunk. Zero if there's no comment.
028 4 Offset to the first byte of the creator-specific data chunk, or zero if there is none.
02C 4 Length of the creator-specific chunk; zero if there is no creator-specific data.
030 16 Reserved space; this pads the header to 64 bytes. These values must all be zero.

Creator Codes

If the file is created by a Macintosh application, this should be the creator code of the creating application; otherwise, this should be a unique ID specific to the creating application. As a courtesy, you should let A2Pro know the creator code you choose to use for your application.

The following creator codes are already in use by various applications

Application Code
Bernie ][ the Rescue B2TR
Catakig CTKG
[[ http://www.sheppyware.net/software-gs/imagemaker/index.html%7CSheppy's ImageMaker]] ShIm
Sweet 16 WOOF

The Image Format Field

The image format is indicated as one of the following values

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

The Flag Field

The flags field contains bit flags that specify details about the disk image. Bits not defined here must be zero.

Bit Description
31 If this bit is set, the disk image is locked and no changes should be permitted to the disk data it contains. This is used by emulators to provide support for write-protecting disk images.
8 If this bit is set, the low byte of the flags field contains the DOS 3.3 volume number of the disk image. This bit should only be set for DOS 3.3 disk images. If the disk is DOS 3.3 format (the image format is 0), and this bit is 0, volume number 254 is assumed.
7-0 The DOS 3.3 volume number, from 0-254, if bit 8 is set. Otherwise these bits should be 0.