The Converted GEOpaint File Format.
==================================

Identifying a geopaint file.
===========================
When reading the file in 254 byte sectors, the first sector contains the
following identifying bytes, 1,7 at postition 22 (offset 21).
The second sector contains the following text at position 76 (offset 75),
"Paint Image".

The first two sectors also contain the following useful information:
Sector Postion   Length                               Description
------ -------   ------                               -----------
 1      4        upto 16, terminated by a 160 byte    The c64 filename.
 2      159      until end of sector, or a 0 byte.    A description of file.


Sector 3, the segment list.
==========================
This sector lists the 45 segments in a geopaint picture. See later for 
segment format.
Each segment is described by two bytes. The first is the number of sectors
each segment uses, and the second is the number of bytes used in the
last sector of the segment plus 2.
Some segments are empty, this is denoted by a 0,255 byte combination.


Segment format.
==============
Each segment of screen is stored in compressed format. Once decompressed,
the bytes are in the same sequence as the way data is stored on a c64 hires
screen. The uncompressed seqment size is 1280 bytes of bitmap data, which
gives a screen area of (80 times 8) by 16 pixels wide (640x16).

Each segment also includes 160 bytes of colour information, which follows
the bitmap data. This is also encoded, although I have not tried to use
this in my example decoding programs since MOSt geos pictures are just 
black & white.

The exact format is as follows 1280 bytes of bitmap, then 8 null bytes,
then 160 colour bytes. (I'm not sure if all geos files have the 8 null
bytes or not but the ones I saw did.)

This results in a total screen size of (80x8)by(45x16) pixel screen size,
which is 640 by 720.

In my example GEO?.BAS programs, I have ignored the colour data, and just
converted the bitmap data since most geos pictures just use black & white.


Uncompressed Data format for each segment.
=========================================
bitmap data, format similar to hires pictures

byte 0001 , byte 0009 , ........................... , byte 0633
byte 0002 , byte 0010 , ........................... , byte 0634
byte 0003 , byte 0011 , ........................... , byte 0635
byte 0004 , byte 0012 , ........................... , byte 0636
byte 0005 , byte 0013 , ........................... , byte 0637
byte 0006 , byte 0014 , ........................... , byte 0638
byte 0007 , byte 0015 , ........................... , byte 0639
byte 0008 , byte 0016 , ........................... , byte 0640
byte 0641 , byte 0649 , ........................... , byte 1273
byte 0642 , byte 0650 , ........................... , byte 1274
byte 0643 , byte 0651 , ........................... , byte 1275
byte 0644 , byte 0652 , ........................... , byte 1276
byte 0645 , byte 0653 , ........................... , byte 1277
byte 0646 , byte 0654 , ........................... , byte 1278
byte 0647 , byte 0655 , ........................... , byte 1279
byte 0648 , byte 0656 , ........................... , byte 1280

colour data, format similar to hires pictures

byte 001, byte 002, ............................... , byte 080
byte 081, byte 082, ............................... , byte 160

Compressed Data format.
======================
The format is simply a code byte followed by some data. There are three
types of code bytes:
   1 to  64 - determine the number of individual bytes that follow.
  65 to 127 - are used for fill patterns. The code byte minus 64 determines
              the number of times to repeat the pattern.
              The code byte is followed by eight bytes which is the fill
              pattern.
 129 to 255 - Code byte minus 128 gives number of times to repeat a byte.
              The byte that follows the code byte is the one that is used
              for the repeat.
  other     - (0 & 128) I'm unsure what these do, so just set these to
              display an error of some sort.

PPM output format. (not compressed)
=================
The output is at follows:
P6
width length
255
<picture data>
where each pixel of picture data is represented by 3 bytes R G B.
0,0,0 is black  255,255,255 is white.

