# RGB color conversion

Страница 3/3
1 | 2 |
hit9918 wrote:

But it hasn't yet taken into acount the nonlinear DAC levels
In the below code I got them in that l() function, I forgot from where I got them?

Ha, nice . I guess these levels should be in the openMSX source code somewhere?

So in the end, what are the 24bit RGB values for the screen 8 colors?

These values:
red = [ 0, 43, 82, 118, 153, 188, 222, 255];
green = [ 0, 43, 82, 118, 153, 188, 222, 255];
blue = [ 0, 82, 153, 255];
improve red and green, but still there is something strange on the blue levels...

Are you sure that blue is just a subset of levels of the other colors?

Yes. The V9938 DAC is 3-bit, so it can only produce those eight values, and the 2-bit blue values can’t be reproduced linearly. Easy to check for yourself in the emulator; `screen 8:color 255,1,2:cls: i\$=input\$(1):screen 1:color=(1,0,0,2):color=(2,0,0,4)`. Screenshot and compare.

You are right,level 1 and 2 look the same of 2 and 4 on openmsx. I will try your test on real HW this weekend

For SCREEN 8: I can suggest that you can store the colors defined with DIM:

```dim p(15),g(7),r(7),b(3)

for j=0 to 7
g(j)=j*32
r(j)=j*4
next j
for j=0 to3
b(j)=j
next
```

Or you can use all 256 redefines with DIM!

```dim p(256),g(7),r(7),b(3)
```

You can add an alternate color with an RGB and
save to P (16,17,18,...256).

```p(16)=r(2)+g(6)+b(0)
```

And you can collect all the favorite colors. In this case, do not forget to store all the palette table in the source (in ASM or other language).
Greetings
DanySoft

Страница 3/3
1 | 2 |