Arrrrrrggg, how did you do that? You found a different, yet perfect solution to a weird problem I never thought would end up like this....
Ok... Fine... Great...
Next, the 2 palettes.
Now, I'm telling you this so you could construct 2 real palette .mif files...
For the text mode/sprites, the data in the 16 bit output goes like this:
1 0
6 0
AAAA RRRR GGGG BBBB
The RGB are 12 bit color data like you are used to.
The A is a 4 bit translucency value. 0 being 100% opaque, 15 being completely translucent to the graphics mode beneath.
The text colors are as follows:
0 through 15 = The outline color, or, pixel data = 0 color. Whenever a font has a 0 bit, depending on your character color background selection, one of these 16 colors will be used.
16 through 31 = The pen color, or, pixel data = 1 color. Whenever a font has a 1 bit, depending on your character color foreground selection, one of these 16 colors will be used.
(When making a default VGA palette, for now, the foreground and background colors may be mirror or offset values. Whatever mimics VGA's 16 text color settings)
For the graphics palette, colors 0 through 255 are used in order, however, the 16bits hold the color differently:
1 0
6 0
RRRRR GGGGGG BBBBB
This is known as 565 color, being 5 bits red, 6 bits green, 5 bits blue.
I would look for an old VGA paint software palette to close as close as possible for the 256 color palette truncated to the 565 standard while for the text, look for the standard 16 colors used by VGA. Copy those to the text palette in 12bit color, plus, use 0 for the alpha channel except for background color 0.
The palette module should be external between the OSD and Stencil. It should pass through the HDE,VDE,HS,VS with appropriate internal delay to match the speed of the palette memories.
You will need a host port to read & write to the palette as well.
The palette should have 2 inputs, the text top layer and graphics bottom layer feeding the 2 palettes. The output for now will just be the text layer palette. We will do the translucency mixer math after the line address generators as they are needed to feed the graphics bottom layer.