Thanks al lot, sd_snatcher!

May I ask how did you obtain the SCREEN8 palette? It seems that Red and Green are just an homogeneous subdivision of 256/7, while Blue has the last step greater than the others (0,73,146,255). How did you measure it?

Regarding aspect ratio, in the palettes you mention 1.38, which is what I remember from my BASIC programming days, but in the reddit post you say 1.14. Is that the PAL vs NTSC difference? I think I'll have to unbox my PAL MSX2 and connect it, because I tried the 1.38 ratio and it looks too horizontal to my eyes... I was a PAL user, but I don't remember it being so horizontal...

MSX Palette Screen 8:

for i=0 to 255 rm=(i\32) gm=(i\4) and 7 bm=i and 3 next i

MSX->PC

rp = rm*36 gp = gm*36 bp = bm*84

PC->MSX Screen 8

rm = (rp\32)*32 gm = (gp\32)*4 bm = bp\64 color = rm OR gm OR bm

PC->MSX Screen < 8

rm = rp\32 gm = gp\32 bm = bp\32

Dolphin101546015: The blue component in screen 8 is not linear, the four 2-bit values translate to 3-bit values 0, 2, 4, 7 which are then output linearly. This is because the V9938 has a 9-bit DAC with 3 bits per channel. The V9958 has a 15-bit DAC so even the 3-bit colour values are not linear and they are further mapped to 5 bits each, though the quantisation error is more subtle there. See my post here.

So asiga for the blue component you indeed end up with 8-bit values 0, 73, 146, 255 if scaled linearly. Note that this is for the gamma of CRT screens, and for correct display on modern PC monitors you also need to correct for gamma (2.4 -> 2.2), you can do this by applying a ~1.1 curve. This gamma correction can also be done with an embedded CRT colour profile in the image file and editor, which is arguably the better way.

*asiga*wrote:

It seems that Red and Green are just an homogeneous subdivision of 256/7

255 / 7 actually.

Thanks a lot, very complete explanation!!

BTW, @Grauw, when you say a gamma of 1.1, do you mean 1/1.1 instead?

I say this because for example you say that 73 is before gamma. But (73/255)^1.1=64 while (73/255)^(1/1.1)=82 (and 82 is the value you say results after a gamma of 1.1 in your older post that you linked.

Using 1.1 or 1/1.1 depends on which direction you calculate it, from MSX gamma (CRT TV: ~2.4) to PC gamma (sRGB monitor: ~2.2) or vice versa. The 1.1 value I mentioned originally is in the context of converting PC graphics to MSX, so when doing the opposite you indeed have to use the inverse. (And I quoted the wrong one here, sorry for the confusion, it’s easy to mix up.)

The full calculation from MSX to PC is (((x/7)^(1/2.4))^2.2)*255 which first cancels out the CRT’s gamma (1/2.4) and then applies the sRGB gamma (2.2). Via the power rule you can multiply the exponents with each other to simplify to a single exponent, (1/2.4) * 2.2 = 2.2 / 2.4 = 0.91667, and for the inverse transformation 2.4 / 2.2 = 1.09091.

This latter one is the value mentioned, rounded up to 1.1 for convenience since the mentioned gammas aren’t precise anyway, and using only an exponentiation is a simplification as well (but good enough). OpenMSX uses this value too so in the emulator you will get an exact match, and on a CRT TV it varies a bit depending on the brand / model (due to cathode ray & phosphor physics and loose 80s calibration) but it will be more or less in the right spot as well.