Dec 312017
Software for setting OS/2 PM pallette, includes ASM source code. | |||
---|---|---|---|
File Name | File Size | Zip Size | Zip Type |
OS2PAL.ASM | 3198 | 582 | deflated |
PAL.DOC | 4958 | 2270 | deflated |
PAL2.ASM | 3947 | 889 | deflated |
PALETTE.C | 5356 | 1757 | deflated |
PALETTE.DEF | 380 | 220 | deflated |
PALETTE.MK | 297 | 166 | deflated |
Download File PMPAL.ZIP Here
Contents of the PAL.DOC file
Color palette change under PM
The current versions os OS/2 (1.1 and 1.2) do not support color
palette change. That is strange, because of the following facts:
- On the EGA and VGA cards is is very simple to do that.
- In 1987 IBM announced the new PS/2 with a VGA with 16 colors out of
a palette with 262144 colors and a new multitasking graphics
oriented operating system. The last thing is released two years
later, but no choice out of 262144 colors, but just 16 out of 16
colors is supported.
- There are two system calls called GpiRealizeColorTable(hps) and
GpiUnRealizeColorTable(hps), but they do nothing.
There are many GIF picture freaks on this BBS and they will miss it.
I also created a GIF viewer for PM but with support for direct
palette manipulation through an IOPL routine which writes directly to
the VGA DACs (VIEWGIF3.ZIP on this BBS), which works on all VGA and
Super VGAs and (I'm not sure) 8514A. Does somebody know if this
will change in future versions of OS/2 ? I think the Unix approach is
much better. With X/Windows the XCreateColormap() function can
create a color map for an application and when the user switches to
another application, the physical palette registers are adapted to
the currently active application automatically, so the inactive
applications go 'technicolor' (when the current application has a
different color map than the default X/Windows colors). I used this
approach with VIEWGIF.
Here is a short description of the routines:
--------------------------------------------
The routine OS2PAL.ASM changes EGA and VGA palettes directly.
Only direct hardware access works. The documentation in
Richard Wilton: PC & PS/2 Video Systems (Microsoft Press), recommended!
is more about BIOS but INT 10 calls are strictly prohibited under OS/2 !! So
I found out how the VGA BIOS worked with Nu Mega's Soft-ICE with trapping the
VGA card's BIOS calls which modified the palettes. I made assembly routines
(OS2PAL.ASM) and they worked under DOS and OS/2 on Video 7, Paradise, Compaq
VGA and IBM PS/2 display aadapters with any 16 or 256 color resolution or PM
driver.
When this routine is used, the following lines should be added to the .DEF
file of your program (or DLL):
SEGMENTS PALETTE IOPL
EXPORTS
SETPAL_EGA 2
SETPAL_VGA 3
The values are entered as:
void pascal far setpal_ega(USHORT color_number, USHORT palette_register);
color_number is from 0 to 15 and palette register is from 0 to 63 with the
following bits:
1 - dark blue
2 - dark green
4 - dark red
8 - light blue
10 - light green
20 - light red
void pascal far setpal_vga(USHORT color_number, ULONG dac_register);
color_number is from 0 to 15 with 16 color PM drivers, dac_register is a long
consisted of three bytes RGB which each value from 0 to 63. E.g. yellow =
0x00003F3F, white = 0x003F3F3F. Red and blue are reversed to PM !
In setpal_vga() the color number is remapped to the palette register number
when a 16 color PM driver is used, in the same way as any VGA BIOS does. This
remapping should be disabled when a 256 color mode is used, so a color number
corresponds with a DAC register.
PAL2.ASM:
void pascal far remapallpalette(USHORT ncolors, COLOR far *table);
This routine is much better, is is VGA only, but the format of the color
table matches the PM COLOR union. The number ncolors must be either 16 or 256
dependant on the current PM driver DISPLAY.DLL. Moreover, the color intensity
of PM does not match with the real intensity. So is 'dark blue' 0x0000AA and
not 0x000080 as GpiQueryRealColors() says. PALETTE.C contains a conversion
routine between these the color intensity tables of PM and of 'real' VGA. It
if for both version 1.1 and 1.2. There are also two 'Gpi' routines in which
you can use as an extension to PM. You can make a DLL from this routine with
make palette.mk
The data should be nonshared (see PALETTE.def).
You should add this line in the main window procedure of your program to
restore the default palette when your program gets inactive:
/* current_pid is supposed to be the PID of the current program */
case WM_FOCUSCHANGE:
WinQueryWindowProcess((HWND)mp1, (PPID)&pid, (PTID)&tid);
if (pid == current_pid) /* do not change when another window of the */
break; /* same process (e.g. a dialog box) is shown */
if (SHORT1FROMMP(mp2)) /* application gains focus */
/* ..... set application color palette ..... */
else /* application loses focus */
/* ..... set system default palette ........ */
break;
Klaas van Ditzhuyzen
DATAD Telecom
P.O.Box 371 3900 AJ Veenendaal Holland
Tel +31 8385 33400
colleague of Martin Vermeer #839 on Magnum BBS : (805) 581-1275
The current versions os OS/2 (1.1 and 1.2) do not support color
palette change. That is strange, because of the following facts:
- On the EGA and VGA cards is is very simple to do that.
- In 1987 IBM announced the new PS/2 with a VGA with 16 colors out of
a palette with 262144 colors and a new multitasking graphics
oriented operating system. The last thing is released two years
later, but no choice out of 262144 colors, but just 16 out of 16
colors is supported.
- There are two system calls called GpiRealizeColorTable(hps) and
GpiUnRealizeColorTable(hps), but they do nothing.
There are many GIF picture freaks on this BBS and they will miss it.
I also created a GIF viewer for PM but with support for direct
palette manipulation through an IOPL routine which writes directly to
the VGA DACs (VIEWGIF3.ZIP on this BBS), which works on all VGA and
Super VGAs and (I'm not sure) 8514A. Does somebody know if this
will change in future versions of OS/2 ? I think the Unix approach is
much better. With X/Windows the XCreateColormap() function can
create a color map for an application and when the user switches to
another application, the physical palette registers are adapted to
the currently active application automatically, so the inactive
applications go 'technicolor' (when the current application has a
different color map than the default X/Windows colors). I used this
approach with VIEWGIF.
Here is a short description of the routines:
--------------------------------------------
The routine OS2PAL.ASM changes EGA and VGA palettes directly.
Only direct hardware access works. The documentation in
Richard Wilton: PC & PS/2 Video Systems (Microsoft Press), recommended!
is more about BIOS but INT 10 calls are strictly prohibited under OS/2 !! So
I found out how the VGA BIOS worked with Nu Mega's Soft-ICE with trapping the
VGA card's BIOS calls which modified the palettes. I made assembly routines
(OS2PAL.ASM) and they worked under DOS and OS/2 on Video 7, Paradise, Compaq
VGA and IBM PS/2 display aadapters with any 16 or 256 color resolution or PM
driver.
When this routine is used, the following lines should be added to the .DEF
file of your program (or DLL):
SEGMENTS PALETTE IOPL
EXPORTS
SETPAL_EGA 2
SETPAL_VGA 3
The values are entered as:
void pascal far setpal_ega(USHORT color_number, USHORT palette_register);
color_number is from 0 to 15 and palette register is from 0 to 63 with the
following bits:
1 - dark blue
2 - dark green
4 - dark red
8 - light blue
10 - light green
20 - light red
void pascal far setpal_vga(USHORT color_number, ULONG dac_register);
color_number is from 0 to 15 with 16 color PM drivers, dac_register is a long
consisted of three bytes RGB which each value from 0 to 63. E.g. yellow =
0x00003F3F, white = 0x003F3F3F. Red and blue are reversed to PM !
In setpal_vga() the color number is remapped to the palette register number
when a 16 color PM driver is used, in the same way as any VGA BIOS does. This
remapping should be disabled when a 256 color mode is used, so a color number
corresponds with a DAC register.
PAL2.ASM:
void pascal far remapallpalette(USHORT ncolors, COLOR far *table);
This routine is much better, is is VGA only, but the format of the color
table matches the PM COLOR union. The number ncolors must be either 16 or 256
dependant on the current PM driver DISPLAY.DLL. Moreover, the color intensity
of PM does not match with the real intensity. So is 'dark blue' 0x0000AA and
not 0x000080 as GpiQueryRealColors() says. PALETTE.C contains a conversion
routine between these the color intensity tables of PM and of 'real' VGA. It
if for both version 1.1 and 1.2. There are also two 'Gpi' routines in which
you can use as an extension to PM. You can make a DLL from this routine with
make palette.mk
The data should be nonshared (see PALETTE.def).
You should add this line in the main window procedure of your program to
restore the default palette when your program gets inactive:
/* current_pid is supposed to be the PID of the current program */
case WM_FOCUSCHANGE:
WinQueryWindowProcess((HWND)mp1, (PPID)&pid, (PTID)&tid);
if (pid == current_pid) /* do not change when another window of the */
break; /* same process (e.g. a dialog box) is shown */
if (SHORT1FROMMP(mp2)) /* application gains focus */
/* ..... set application color palette ..... */
else /* application loses focus */
/* ..... set system default palette ........ */
break;
Klaas van Ditzhuyzen
DATAD Telecom
P.O.Box 371 3900 AJ Veenendaal Holland
Tel +31 8385 33400
colleague of Martin Vermeer #839 on Magnum BBS : (805) 581-1275
December 31, 2017
Add comments