Format of Bitmap files
Last modified 1996-01-26

A bitmap file (also called a .PIC file) begins with an 8 byte header of the
following form:
  Offset  0 to   2: "PIC"
  Offset  3 (byte): $DC
  Offset  4 (byte): format version number
  Offset  5 (byte): OPL runtime version number
  Offset  6 (word): number of bitmaps in the file

The format and OPL runtime version number are always $30.

This header is then followed by the appropriate number of bitmap descriptor
records. These are each 12 bytes:
  Offset  0 (word): CRC of bitmap data (but not descriptor)
  Offset  2 (word): width of bitmap
  Offset  4 (word): height of bitmap
  Offset  6 (word): size of bitmap data in bytes
  Offset  8 (long): distance from the end of this record to the start of
                    the data, in bytes.

Note that offset 8 is relative to the current record, not to the end of all
the descriptor records. For example, if the file contains 3 bitmaps of 48,
52, and 30 bytes respectively, the three offsets are 24 (2 * 12), 60 (1 * 12
+ 48), and 100 (48 + 52). If a fourth bitmap is added at the end, these three
will be increased by 12, and the fourth offset will be 130 (48 + 52 + 30).

The data is stored from top to bottom. Each row is rounded up to an even
number of bytes, and is stored from left to right, with bit 0 of each byte
being the leftmost pixel of the 8 represented.
No Comments
Back to top