First post, by fuxx
Hi,
please excuse my horrible english. If i posted this question to wrong place please excuse me too.
I extracted several screens from old DOS game which runs in EGA mode 0xd (320x200x16) and game palette table. This game runs in DOSBox well.
Those screens are just dumps of all four color planes of ega screen in mode 0xd. I can convert and dump those screens to BMP file. The picture is correct, but i can not figure out how to convret game palette to modern 24bit colors. The game uses bios int 0x10 to set palette, but i wrote my own conversion routine. But my algorithm gives me wrong colors.
I briefly scanned DOXBox sources but can not figure out where does palette is converted to dosbox screen colors. I believe this code could help me. But was not able to find one.
In case you interested how i do color conversion, here is my algorithm:
/* xxrgbRGB scheme */
r = 0x40*(((dc & 0x20) >> 5)&1) + 0xb0*((((dc & 0x04) >> 2)&1));
g = 0x40*(((dc & 0x10) >> 4)&1) + 0xb0*((((dc & 0x02) >> 1)&1));
b = 0x40*(((dc & 0x08) >> 3)&1) + 0xb0*((((dc & 0x01) >> 0)&1));
variable dc here is dos color. This code is based on assumption that bits 7 and 6 aren't used, 5-3 are lowintensity rgb bits of color, and 2-0 are hi intensity RGB bits.
If someone is able to help me to find color conversion code in DOSBox, or can give me correct conversion algorithm, or point to right manual, or even simply show bug in my code, i will be greatly appreciated.
---
Thank you in advance,
Serge