Path: utzoo!mnetor!uunet!husc6!think!ames!pasteur!ucbvax!TIS.COM!dmb From: dmb@TIS.COM (David M. Baggett) Newsgroups: comp.sys.atari.st Subject: Picture Formats!! Message-ID: <8805031609.AA01371@TIS.COM> Date: 3 May 88 16:09:43 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 184 A while back I asked about picture formats. Thanks to all who responded. Since *lots* of people have being asking about formats, I compiled all the format descriptions and rewrote them. Hopefully, they're coherent and correct. Please report errors in the file to me (dmb@tis.com). Here 'tis: ---------------------------Cut Here---------------------------------------- ST Picture Formats ------------------ Introductory information word = 2 bytes long = 4 bytes palette = Hardware color palette, stored as 16 words. First word is color register zero (background), last word is color register 15. Each word has the form: Bit: (MSB) 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (LSB) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 0 0 0 0 0 R2 R1 R0 0 G2 G1 G0 0 B2 B1 B0 R2 = MSB of red intensity R0 = LSB of red intensity G2 = MSB of green intensity G0 = LSB of green intensity B2 = MSB of blue intensity B0 = LSB of blue intensity Intensity ranges from 0 (color not present) to 7 (highest intensity). Example: { red = 7, green = 3, blue = 5 } -> 0735 (hex) The Formats 1 long resolution (0 = low res, 1 = medium res, 2 = high res) 16 words palette 12 bytes filename (" . ") 1 byte Left color animation limit (starting color number) 1 byte Right color animation limit (ending color number) 1 byte color rotation speed 1 byte color rotation direction 1 word color rotation duration (number of iterations) 18 longs reserved for expansion 16000 words picture data (screen memory) ----------- 32128 bytes total 1 word resolution (0 = high res, 1 = medium res, 2 = low res) 16 words palette 16000 words picture data (screen memory) ----------- 32034 bytes total 1 word resolution (0 = high res, 1 = medium res, 2 = low res) 16 words palette 16000 words picture data (screen memory) 4 words left color animtion limit table (starting color numbers) 4 words right color animation limit table (ending color numbers) 4 words animation channel direction flag (0 = left, 1 = off, 2 = right) 4 words animation channel delay in 1/60's of a second. [0 - 128] ----------- 32066 bytes total 16000 words picture data (screen memory) ----------- 32000 bytes total 1 byte resolution (same as NEO, but +3 indicates rotation information follows) If resolution > 2 { 1 byte left and right color animation limits. High 4 bits hold left (start) limit; low 4 bits hold right (end) limit 1 byte direction and speed of color animation (negative value indicates left, positive indicates right, absolute value is delay in 1/60's of a second. 1 word color rotation duration (number of iterations) } 1 word number of control bytes 1 word number of data bytes 16 words palette 3-10667 bytes control bytes 2-32000 bytes data bytes ------------- 42-32044 bytes total Control byte meanings: For a given control byte, x: x < 0 Absolute value specifies the number of unique words to take from the data section (from 1 to 127) x = 0 1 long is taken from the control section which specifies the number of times to repeat the next data word (from 128 to 32767) x = 1 1 word is taken from the control section which specifies the number of unique words to be taken from the data section (from 128 - 32767) x > 1 Specifies the number of times to repeat the next word taken from the data section (from 2 to 127) 80 words First scan line of picture (unused) -- should be zeroes 15920 words picture data (screen memory) for scan lines 1 through 199 9552 words 3 palettes for each scan line (the top scan line is not included because Spectrum 512 can't display it) ----------- 51104 bytes total 1 word 5350 (hex) ("SP") 1 word 0 (reserved for future use) 1 long length of data bit map 1 long length of color bit map <= 32092 bytes compressed data bit map <= 17910 bytes compressed color bit map -------------- < 50014 bytes total Data compression: Compression is via a modified run length encoding (RLE) scheme. The data map is stored as a sequence of records. Each record consists of a header byte followed by one or more data bytes. The meaning of the header byte is as follows: For a given header byte, x: 0 <= x < 127 Use the next x + 1 bytes literally (no repetition) -128 <= x < 0 Use the next byte -x + 2 times The data appears in the following order: 1. Picture data, bit plane 0, scan lines 1 - 199 2. Picture data, bit plane 1, scan lines 1 - 199 3. Picture data, bit plane 2, scan lines 1 - 199 4. Picture data, bit plane 3, scan lines 1 - 199 Decompression of data ends when 31840 data bytes have been used. Color map decompression: Each 16-word palette is compressed separately. There are three palettes for each scan line (597 total). The color map is stored as a sequence of records. Each record starts with a 1-word bit vector which specifies which of the 16 palette entries are included in the data following the bit vector (1 = included, 0 = not included; i.e., stays the same). The least significant bit of the bit vector refers to palette entry zero, while the most significant bit refers to palette entry 15. Bit 15 must be zero, since Spectrum 512 does not use palette entry 15. Bit 0 should also be zero, since Spectrum 512 always makes the background color black. The words specifying the values for the palette entries indicated in the bit vector follow the bit vector itself, in order (0 - 15). ---------------------------Cut Here----------------------------------------