Advanced OCP Art Studio File Formats

This document describes the structure of the files used by "OCP Advanced Art Studio", a art utility for the Amstrad CPC, published by "Rainbird".

The files covered are:

Note:

The palette ".PAL" file structure

The palette file has an extension of ".PAL". This file contains the display mode, palette and colour animation for a Advanced Art Studio window or screen.

The palette file has the same name as the window or screen it was saved with. (e.g. The screen file "raytrace.scr" will have a palette file named "raytrace.pal").

The file is binary and has the following properties:

The file has the following structure:

Offset (decimal) Count Description
0 1 Screen mode (see note 1)
1 1 Colour animation flag: "FF" = colour animation active, "00" = no colour animation
2 1 Colour animation delay in frames - 1 (see note 2)
3 1*12 palette entry 0: colours for 12 frames (see note 3)
15 1*12 palette entry 1: colours for 12 frames (see note 3)
27 1*12 palette entry 2: colours for 12 frames (see note 3)
39 1*12 palette entry 3: colours for 12 frames (see note 3)
51 1*12 palette entry 4: colours for 12 frames (see note 3)
63 1*12 palette entry 5: colours for 12 frames (see note 3)
75 1*12 palette entry 6: colours for 12 frames (see note 3)
87 1*12 palette entry 7: colours for 12 frames (see note 3)
99 1*12 palette entry 8: colours for 12 frames (see note 3)
111 1*12 palette entry 9: colours for 12 frames (see note 3)
123 1*12 palette entry 10: colours for 12 frames (see note 3)
135 1*12 palette entry 11: colours for 12 frames (see note 3)
147 1*12 palette entry 12: colours for 12 frames (see note 3)
159 1*12 palette entry 13: colours for 12 frames (see note 3)
171 1*12 palette entry 14: colours for 12 frames (see note 3)
183 1*12 palette entry 15: colours for 12 frames (see note 3)
195 1*12 border: colours for 12 frames (see note 3)
207 16 excluded inks (see note 4)
223 16 protected inks(see note 5)

Notes:

  1. screen mode is:
  2. The colour animation delay is the number of frames (at 50fps) to wait between updates to the colour palette.
  3. There are 12 bytes for each colour palette entry. Each byte is a hardware colour number in the format that can be written directly to the Gate-Array (e.g. bit 7="0", bit 6="1", bit 5="0" and bit 4..0 define the hardware colour index). See the document on the Gate Array for the hardware colour numbers and their associated colour. Each byte is the colour for a frame, and therefore there are 12 frames for colour animation effects.
  4. excluded inks
  5. protected inks

The window (".WIN") file format

The window file has an extension of ".WIN".

A window is a rectangular area of bitmapped graphics that has been cut from a bitmapped screen. The pixel data in the file can be compressed or uncompressed.

The mode and palette information for the window file is stored in a seperate palette file.

The file is binary and has the following properties:

The file has the following structure:

Offset (decimal) Length Description
0 length-5 Window pixel data (see note 1)
length-4 2 Width of window in pixels (see note 2)
length-2 1 Height of window in lines/2
length-1 1 ?

Notes:

  1. Window pixel data:
  2. The width of the window is defined in mode 2 sized pixels regardless of the actual display mode. To calculate the width of the window in mode 1 sized pixels, divide the width of the window by 2. To calculate the width of the window in mode 0 sized pixels, divide the width of the window by 4.
  3. With bitmapped screens, each byte of pixel data describes one or more pixels directly.

The screen (".SCR") file structure

The screen file contains the pixel data for a entire bitmapped screen.

The file is binary and has the following properties:

Notes:

  1. The screen file describes pixel data for a mode 0, mode 1 or mode 2 screen.
  2. The screen is always 200 lines tall, and 80 bytes wide. This corresponds to a resolution of:
  3. If the file is compressed, after decompression, each byte of the pixel data is in the format that the hardware uses. If the file is not compressed, each byte of the pixel data will already be in the format that the hardware uses. Each byte describes:
  4. If the pixel data is compressed, the file size will be less than 16384 bytes. The compression method is described here.
  5. If the screen is not compressed it will be exactly 16384 bytes.
  6. The entire pixel data is in the format that the hardware uses:

    The following table shows the start offset of each line in the screen file.

    Offset Length Description
    &0000 (line 0 + &0000)80Line 0 of image
    &0800 (line 0 + &0800)80Line 1 of image
    &1000 (line 0 + &1000)80Line 2 of image
    &1800 (line 0 + &1800)80Line 3 of image
    &2000 (line 0 + &2000)80Line 4 of image
    &2800 (line 0 + &2800)80Line 5 of image
    &3800 (line 0 + &3000)80Line 6 of image
    &3800 (line 0 + &3800)80Line 7 of image
    &0080 (line 8 + &0000)80Line 8 of image
    &0880 (line 8 + &0800)80Line 9 of image
    &1080 (line 8 + &1000)80Line 10 of image
    &1880 (line 8 + &1800)80Line 11 of image
    &2080 (line 8 + &2000)80Line 12 of image
    &2880 (line 8 + &2800)80Line 13 of image
    &3080 (line 8 + &3000)80Line 14 of image
    &3880 (line 8 + &3800)80Line 15 of image
    .........
    .........
    .........
    .........
    &0780 (line 192 + &0000)80Line 192 of image
    &0f80 (line 192 + &0800)80Line 193 of image
    &1780 (line 192 + &1000)80Line 194 of image
    &1f80 (line 192 + &1800)80Line 195 of image
    &2780 (line 192 + &2000)80Line 196 of image
    &2f80 (line 192 + &2800)80Line 197 of image
    &3780 (line 192 + &3000)80Line 198 of image
    &3f80 (line 192 + &3800)80Line 199 of image

    The following equation can be used to calculate the offset of any line:

    offset = ((line AND 7)*&800) + ((line/8)*&80)

  7. With bitmapped screens, each byte of pixel data describes one or more pixels directly.

The font ".FNT" file format

The font file format describes the characters in a monochrome bitmapped font.

The file is binary and has the following properties:

Notes:

The following equation can be used to calculate the start of the character

offset = (ascii_code - 32)*8

Compression algorithm used by pixel data in window and screen files

If data is compressed using this algorithm, there will be one or more "compressed blocks".

A "compressed block" has the following structure:

Offset Length Description
03Identification bytes: "M","J" and "H" in that order
32Length of uncompressed data in this block (note 1)
5...Compressed data for this block (note 2)

Notes:

  1. The decompression algorithm used by OCP Advanced Art Studio does not allow more than "length of uncompressed data in this block" bytes to be written, even if the data describes more bytes. The surplus bytes are ignored.
  2. The compression method is based on "run length encoding". "run length encoding" is a simple compression algorithm which can compress groups of repeated bytes.

    The compressed data in each block will contain single data bytes and run-length packets.

    A "marker" byte is used to identify a run-length packet.

    Each packet has the following structure:

    Offset Length Description
    01marker (see note 1)
    11count (see note 2)
    21byte (see note 3)

    Notes:

    1. The "marker" identifies a run-length packet. The compression method used in OCP Advanced Art Studio files has a marker of "&01".
    2. The "count" defines the number of times the data-byte repeats. A count of "&00" means the byte is repeated 256 times.
    3. The "byte" is the actual data byte to output when decompressing.

    If the marker exists in the data before compression, it will be encoded as the following run-length packet:

    marker, 1, marker

    i.e. &01, 1, &01 for OCP Advanced Art Studio files.

  3. The uncompressed data is written forwards. (i.e. the pointer to the destination uncompressed data is incremented after each uncompressed byte is written)
  4. The uncompressed data is written in a continuous block, there is NO re-arrangement of the data.