• Please review our updated Terms and Rules here

Windows 3.1 modify system palette (VGA)

Mills32

Experienced Member
Joined
Sep 25, 2018
Messages
149
Location
Spain
Hi.
I wonder if the system palette in windows 3.1 can by modified. I'm using VGA driver (640x480 16 colors), so the graphics card can do it.
According to windows 3 docs, the system uses fixed colors which can't be modified by programs, also if I wrote a little program to change VGA registers, it would work until windows restarts and sets the predefined colors again. I wanted to use pico-8 palette, imagine using paintbrush and cool wallpapers with that.

My card also supports 640x480 256 colors, but it does not make things different, the system colors are just the same, and can't be modified.

I think the system palette might be stored somewhere in the windows files, so maybe I can just modify the files, or there is some software to modify them.

Thanks.
 
doubt it, win3.1 runs in protected mode, so probably traps IO access to the vga hardware... my memories are foggy, maybe it was 3.11 that was pmode and 3.1 not? I think some build of 3.x was not protected mode..
 
I think you are getting mixed up with Windows for Workgroups 3.11. Plain old MS Windows 3.1/3.11 runs fine on my 286 in Standard Mode.
 
Im confused about this whole topic. You can easily change colors in earlier windows using color in control panel.

1651611163415.png
 
I think you are getting mixed up with Windows for Workgroups 3.11. Plain old MS Windows 3.1/3.11 runs fine on my 286 in Standard Mode.
I was talking about 3.1, it works on 286.

Im confused about this whole topic. You can easily change colors in earlier windows using color in control panel.

View attachment 1240720
Yes, but you can only rearrange the fixed 16 colors (and create patterns by alternating 2 colors). You can't, for example, change the rgb values of that blue color on the "international" icon, so that you get a better light blue for the little Earth.
 
Last edited:
It should be possible to modify the VGA driver to start with a different 16 color palette. VGA.ASM in the DDK has code that defines the initial palette set. Note that the changes could adversely impact programs written for the standard palette.

This will take considerable effort and I hate the poor documentation of Windows Device Drivers.
 
It should be possible to modify the VGA driver to start with a different 16 color palette. VGA.ASM in the DDK has code that defines the initial palette set. Note that the changes could adversely impact programs written for the standard palette.

This will take considerable effort and I hate the poor documentation of Windows Device Drivers.

That's what I was thinking, I have to modify the driver, or compile it... I don't know anything about that.

I just wanted my 286 to have a better looking graphic shell, even a c64 palette would be better than the default one. I was aware of the impact on other programs, it is easy to leave similar colors so that apps will look ok.
 
You could run PCGeos as a Gui. Versions 1.x and 2.x have a Motif look n feel. 16 colours only I'm afraid. But the the PCGeos 3.x plus source code is now freely available at Github as well as the SDK. PCGeos 3.x up is more suited to 386s up I believe.

Bit of the preview over at Nathans Gui page http://toastytech.com/guis/geos12.html

Later PCGeos versions defaulted to a win9x look n feel but you could change that back to the Motif shell if you wanted. http://toastytech.com/guis/bbe2.html
 
Last edited:
You could run PCGeos as a Gui. Versions 1.x and 2.x have a Motif lock n feel. 16 colours only I'm afraid. But the the PCGeos 3.x plus source code is now freely available at Github as well as the SDK. PCGeos 3.x up is more suited to 386s up I believe.

Pit of the preview over at Nathans Gui page http://toastytech.com/guis/geos12.html
I used geos for some time, It looks ok, but a bit slower than windows, and there are very few apps for that gui.

Maybe I'll try to compile a little program for windows that will run at startup and changes the VGA registers once the vga driver is loaded. That's the easiest way I think. But I don't know if windows will load the program every time it comes back from executing a dos game.
 
It should be possible to modify the VGA driver to start with a different 16 color palette. VGA.ASM in the DDK has code that defines the initial palette set. Note that the changes could adversely impact programs written for the standard palette.

This will take considerable effort and I hate the poor documentation of Windows Device Drivers.
I downloaded windows 3.1 DDK, there is a VGA folder containing VGA.ASM, and that looks like the driver itself, with all colors defined there. Changing the values should do, the difficult part is how to set up the development kit and compile the driver.

I'm thinking, if the compiled driver is not modified in weird ways, encrypted or whatever, the values should be there if I open it in a hex editor, I'll just check.

Spoiler: found them!.
 
Last edited:
The generic VGA driver has a table containing the EGA color indexes to be used (from the 64 colors available in EGA), replacing this hex string changes the colors:

Code:
Original: 000c0a0e011523070f241236092D1B3F
Custom:  00040214193536070F24122609272B3F

You can use these custom 16 color with no problem, but windows won't recognize some of them if it loads .bmp or .ico files created with modern software.
To use images with that palette draw an image with "EGA_Nice_Palette", and set "EGA_Export_Palette" before you save it.

Code:
EGA_Nice_Palette
#000000 #aa0000 #00aa00 #aa5500 #ffff00 #ff55aa #0055aa #808080 #c0c0c0 #ff0000 #00ff00 #ffaa00 #0000ff #ffaaaa #55aaff #ffffff

EGA_Export_Palette
#000000 #aa0000 #00aa00 #bfa940 #0c6f8b #820080 #5555aa #808080 #c0c0c0 #ff0000 #00ff00 #ffaa00 #0000ff #ff00ff #55ccff #ffffff



I think it looks awesome for VGA machines stuck in the 16 color mode :).
 

Attachments

  • Sample0.png
    Sample0.png
    902 KB · Views: 14
  • Sample1.png
    Sample1.png
    902 KB · Views: 13
  • Sample3.png
    Sample3.png
    902 KB · Views: 14
  • VGA_DRIVER.zip
    33.3 KB · Views: 5
Back
Top