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.
Palette Files
- burger2227
- Veteran
- Posts: 2467
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
You can create your own palette files
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:
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
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
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
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0