Page 1 of 1

Palette Files

Posted: Fri Jul 04, 2008 12:13 pm
by legenda
Hello,

In some DOS games or demo programs, there are .pal files. They store the palette info and the program sets the palette according to this file.

How are these *.pal files created? How do we create the palette of our drawings?

Do we need a program for that?

Thanks.

You can create your own palette files

Posted: Fri Jul 04, 2008 2:26 pm
by burger2227
You can make your own palette files by reading the color attribute's R, G and B settings. If you create custom colors, they can also be recorded using:

Code: Select all

FOR c = 0 TO maxcolors - 1  ' screen 12 = 15 screen 13 = 255
    OUT &H3C7, c                  'prepares color port for INP reads
    Red = INP(&HC39)           'each sends 0 to 63 value ranges
    Green = INP(&H3C9)
    Blue = INP(&H3C9)
    WRITE #1, Red, Green, Blue
NEXT
The color values can later be read using INPUT #1, Red, Green, Blue in a similar loop. Use OUT &H3C8 to start the setting of the palette and OUT &H3C9 to set the RGB values from the file in the same way.

For Screen 12 that is 16 RGB colors values from 0 to 15
Screen 13 requires 256 RGB color values from 0 to 255

#1 is the file Opened using ".pal" for the extension. Some palette files may use ASCII character codes from 0 to 63 instead of numbers. To read them you need ASC to convert values to numbers again.

If you plan to BSAVE a file just index the color settings at the start of the image array and place the image at Array(48) or Array(768)

Ted