GEM Metafile  *.GEM

Marcel Boom <mboom@mswe.dnet.ms.philips.nl> recently sent me this
format description.  I have reproduced it here, largely unchanged.

The file consists out of a header and the data records. The header has
the following format:

word mf_header:         should be -1, which indicates a metafile
word mf_hlength:        The length of the header part (usually 24 words)
word mf_version:        Version number (usually 101)
word mf_ndcrcfl:        0: NDC coordinates, 2: Raster coordinates
word mf_extends1:       Optional, minimal used x coordinate
word mf_extends2:       Optional, minimal used y coordinate
word mf_extends3:       Optional, maximal used x coordinate
word mf_extends4:       Optional, maximal used y coordinate
word mf_width:          Optional, page width in 0.1 mm
word mf_height:         Optional, page height in 0.1 mm
word mf_coords1:        Optional, coordinate system param 1
word mf_coords2:        Optional, coordinate system param 2
word mf_coords3:        Optional, coordinate system param 3
word mf_coords4:        Optional, coordinate system param 4
word mf_imgflag:        0: No images, 1 contains bit images
word mf_reserved1:      reserved.
word mf_reserved9:      reserved.

After the header follows the data records of the following format:

word 0:                 VDI command number
word 1:                 n: Number of parameters for ptsin array
word 2:                 m: Number of parameters for intin array
word 3:                 Subopcode
word 4 to 4+n:          ptsin array
word 4+n to 4+n+m:      intin array

A VDI command number of -1 signals the end of file.

  The meaning of the arrays can be found in the several GEM programming
  NOTE: The word qualifier is not the Motorola word, but the Intel word,
so high and low byte are swapped!