1

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?

preciousbetine
  • 2,959
  • 3
  • 13
  • 29

1 Answers1

4

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.

fcdt
  • 2,371
  • 5
  • 14
  • 26
  • So with a 24 bit mode, the memory is divided into 24 bit pixels. Drawing a pixel requires me making three 8 bit writes consecutively to memory, right? – preciousbetine Jul 09 '20 at 13:55
  • 1
    Exactly, that's 3 bytes per pixel. For this reason, a 32-bit color mode is selected in most cases, since the color value can then be written in only one step instead of three. Such a color value fits exactly in a 32-bit general-purpose register. – fcdt Jul 09 '20 at 14:28
  • Also old HW (VGA/VESA) was heavily optimized for writing speed ... so rendering was "fast" the reading was much much slower... from what I remember writing was `~50MB/s` and reading `5.5MByte/s` on one of my average machines... There where some exceptions I had one computer based on PC100 chips and the onboard SIS gfx chip with onboard memory had insane speeds and was sometimes even faster than 3DFX however such turbo mode was unstable. Also I once saw an old 486 with PCI gfx card and there was something weird with the PCI bus it run at 100MHz instead of 33MHz and the gfx keep – Spektre Jul 10 '20 at 07:59
  • IIRC old ISA gfx card like trident tops on ~25MByte sec.. Nowadays HW is slow for direct VGA/VESA memory access as its all just emulation ... The real speed is on GPU itself – Spektre Jul 10 '20 at 08:01