Introduction
A .2mg (or .2img) file is an Apple II disk with a 64-byte header in front of it. The header says which program made the file, whether the sectors are in DOS or ProDOS order or are nibbles, how big the disk is, and whether it is locked; and it lets the file carry a comment. It was made for the IIgs emulators and utilities so that a disk image of any size, a 5.25-inch floppy or an 800 KB disk or a hard disk, could be described in one way.
The disk data after the header is read as a sector image (formats 0 and 1) with the same two file systems, DOS 3.3 and ProDOS.
The header
Numbers are little-endian. The layout was read from a real 2IMG file (the GS/OS system disk, made by CiderPress) and agrees with the files of this Mac; nothing here was checked against a specification document.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | Signature | The letters 2IMG |
| 4 | 4 | Creator | Four letters naming the program that made the file |
| 8 | 2 | Header size | 64 |
| 10 | 2 | Version | 1 |
| 12 | 4 | Image format | 0: sectors in DOS 3.3 order; 1: ProDOS order (blocks); 2: nibbles |
| 16 | 4 | Flags | Bit 31: the disk is locked. Bit 8: the low 8 bits are a DOS 3.3 volume number |
| 20 | 4 | ProDOS blocks | The number of 512-byte blocks (for format 1) |
| 24 | 4 | Data offset | Where the disk data starts (64) |
| 28 | 4 | Data length | The length of the disk data in bytes |
| 32 | 4 | Comment offset | Where the comment starts, or 0 |
| 36 | 4 | Comment length | The length of the comment |
| 40 | 4 | Creator data offset | Where data private to the creator starts, or 0 |
| 44 | 4 | Creator data length | Its length |
| 48 | 16 | Reserved | Zeros |
The real example: 2IMG CdrP, header 64, version 1, format 1 (ProDOS order), flags 0, 1,600 blocks, data at 64, 819,200 bytes of data, no comment and no creator data. The file is 819,264 bytes.
The viewer names the creators CdrP (CiderPress; seen on a real file), and, as listed in the 2IMG documents from memory and not checked on files here, !nfc (ASIMOV2), B2TR (Bernie ][ The Rescue), CTKG (Catakig), ShIm (Sheppy's ImageMaker), WOOF (Sweet 16) and XGS! (XGS); any other four letters are shown as they are.
After the header
The disk data comes next. In format 0 and 1 it is a sector image in the order the format names (the viewer also looks at the contents: a DOS 3.3 disk labelled format 1 is read in the order its catalogue parses in). In format 2 it is the 232,960 bytes of a NIB image, which the viewer does not read from inside a 2IMG yet. The comment and the creator's data follow the disk data; the viewer shows the comment's first characters and marks the creator's data as bytes. Bytes the header does not account for are shown as unused.
The viewer reports a header size that cannot be used, a block count that does not match the data length, a data part shorter than 512 bytes, and parts that overlap. It does not read the data offset from anywhere but the header: an offset past the end of the file leaves no disk.
Not described
Known, not yet covered
- Viewer: format 2 (nibbles) inside a 2IMG is refused rather than decoded.
- Reference: the full list of creator IDs is not given, only the ones in the table above.
Unknown
- Reference: only one real 2IMG was available (CiderPress, format 1); format 0, comments, creator data and the flags are checked on built files only, and the field layout is from the real file and from memory, not from the format's own document.
Variants
- Apple II sector image (.DSK, .DO, .PO) – the sectors with no header, in DOS or ProDOS order
- 2IMG disk image – a 64-byte header in front of the sectors
- NIB nibble image – the nibbles of each track as the drive reads them
- WOZ disk image – the bit stream of every track, in chunks
Links
Software
- CiderPress II – tool that makes and reads 2IMG files (Windows, macOS, Linux)
- AppleWin – Apple II emulator (Windows)