t6q4 wrote:Hello,
I was wondering that since in real mode you can use
in real mode to go to 256-colour mode, how can you do this in Pmode? And also, I have just stumbled onto this, so could someone help explain the 256-colour pallete, please.
Thanks.
There are several ways to set a graphics mode:
1. drop from protected mode, call the interrupt, then go back to protected mode and enjoy
2. add v8086 functionality to your os, have it call int 0x10 from there and enjoy. A shame if you happen to run in 64-bit mode
3. write a generic driver that accesses the VGA front-end via its registers. While it works in most cases, some non-VGA cards can screw up big time.
4. write a driver specific for your card. Enjoy everything and hardware acceleration, but leave your friends in the cold.
Overall most people go for #2 because it allows SVGA modes as well, #3 is good second choice since it works in the most cases. Regarding register-level programming, my shameless plug:
VGA Hardware
Regarding the palette, Its basically a substitution table wiuth 256 indices. The color of the pixel goes in, a color signal comes out. The VGA has 18 bits of accuracy here. You can change entries in that table.
I see FreeVGA has already been linked, you might want to read that as well even though its rather obfuscated. You may also want to google for "graphics programming black book" which is a longer, but easier read. (and it comes with sourcecode). You can also look up the VGA test suite in my OS's source if you want a more complete driver.
p.s. VESA-modes are not necessarily VGA-compatible, including low-resolution 8-bit modes.