IMG (DOSIMG)
From Just Solve the File Format Problem
(Difference between revisions)
(first version) |
Dan Tobias (Talk | contribs) (→Format description) |
||
Line 27: | Line 27: | ||
|- | |- | ||
|2 bytes | |2 bytes | ||
− | |compressed size of this track, little-endian, not including this size field but including the next byte | + | |compressed size of this track, [[Endianness|little-endian]], not including this size field but including the next byte |
|- | |- | ||
|1 byte | |1 byte |
Revision as of 00:48, 24 March 2014
Overview
IMG is an RLE-compressed sector-based disk image format probably used by the DOS program HD-Copy and/or others. It should not be confused with raw image files (sector dumps).
There is a Pascal program floating around the internet which includes source code and can convert these IMG files to raw sector dumps. It is called DOSIMG and can be found mainly on various Chinese websites[1][2]
Format description
byte | description |
---|---|
0 | last track on the original disk (either 39 or 79) |
1 | number of sectors per track |
2-166 | one byte for each track, 0x01 if the track is included in the file, 0x00 otherwise (empty/unformatted) |
For each track: | |
2 bytes | compressed size of this track, little-endian, not including this size field but including the next byte |
1 byte | the escape-byte for the RLE coding |
n-1 bytes | The actual sector data, RLE compressed. Should uncompress to at most num_sectors * 512 bytes, rest is filled with zero.
Each byte is copied 1:1 to the output buffer, except when the escape-byte is encountered. Then, the next 2 bytes specify a byte-value and a count-value. To uncompress, copy the first byte after the escape-byte as many times as the second byte implies to the output buffer. |