SPECTRUM 512 Picture File Format Because so many of you have requested it, we're going to describe the SPECTRUM 512 picture file format. This is an official description written by the programmer of SPECTRUM 512, Boris Tsikanovsky. Other descriptions you may see are unofficial -- use them at your own risk. I'm going to describe here the format of the _uncompressed)_ SPECTRUM 512 file (extension .SPU), the one actually used by the SPECTRUM 512 display routine to produce the 512-color picture on the screen. SPECTRUM 512 also uses a slightly modified RLE scheme to compress files when saving them to disk (extension .SPC). You can easily convert .SPC to .SPU and vice versa with SPECTRUM 512 (simply load the original file, then choose either "compressed" or "uncompressed" option when saving). The .SPU file is always 51104 bytes long and consists of two parts: first the bit map (32000 bytes) and then the color map (19104 bytes). Because SPECTRUM 512 cannot display the topmost raster line, you have 199 lines instead of 200. For that reason, the top line in the bit map (the first 160 bytes of the file) contains no useful information and you should simply ignore it (SPECTRUM 512 fills it with zeros). Otherwise the bit map has the usual meaning -- low res, 4 planes, 160 bytes per raster line, giving each pixel a certain color number from 0 to 15. When you want to determine the color of any particular pixel in the .SPU file, you should first find it's color number (using Get Pixel $A002 from A-line, for example; or your own routine). To find the actual color of the pixel, look at the color map portion of the file. It consists of 199 blocks, one 96-byte block per raster line (no dummy top line here!). Each block contains 48-word color values in the usual ST format (00000rrr0ggg0bbb, r=red, g=green, b=blue). You will find the block you need for your particular pixel at the address (Y-1)*96 from the start of the color map, where Y is the Y coordinate of your pixel, 1<=Y<=199. Finding which of the 48 colors in the block is the color of your pixel is a little trickier. To do that you'll need the color number that you found from the bit map and the X coordinate of your pixel. First, multiply the color number by 10. If the color number is even, add 1 to the result; if it's odd, subtract 5. Let's call the resulting number X1. Now, if X is less then X1, leave the color number as it is; if X is more or equal X1 but less then X1+160, add 16 to the color number; and if X is more or equal X1+160, then add 32 to the color number. This adjusted color number (it could be anything from 0 to 47) is the solution to our problem! It shows which of the 48 color values in the block corresponds to your particular pixel. An example: X=139 and the color number is 3. Multiply by 10: 3*10=30. Subtract 5 (because 3 is odd): X1=30-5=25. Okay, 139 is more than 25, but less than 185 (25+160). So, we add 16 to the color number and the result is 19. That pixel's color will be found in the word number 19 of the block. With the above information, you can read any .SPU file to convert it to some other color format or, possibly, write a printer driver for a color printer. If you come up with something exciting, contact the folks at Antic. -Boris Tsikanovsky to control camera heading with s