Search code examples
assemblygraphicsosdevvesa

How to use vga palettes


I switched to VESA mode 105h which is a 256 color mode. When I checked the palette data using AX = 4F09h, I got values that matched the colors displayed on the screen.

When I switched the mode to 118h, a 16.8M color mode, I checked the palette table and the same values are still there even though the colors displayed are different.

How do I get the palette data for the new mode I switched to? Or maybe I am not getting the whole concept right. Can someone explain to me how to get the palette values for a specific mode?


Solution

  • With 256 colors, only an 8-bit color index is specified. the color to be displayed is then looked up in a color palette.

    But 118h is a 24-bit bit color mode and it's a little different there: No color palettes are used there, the color value is given directly as a 24-bit value (8 bits for the red component, 8 bits for the green component and 8 bits for the blue component). One could also say that the values that were previously in the color palette are now written directly into the screen buffer.