1

I am creating a small 32 bit operating system. I have written the boot loader in assembly language, written the kernel's entry in assembly and I am currently writing the kernel in c. In the bootloader, I have already switched to 32 bits protected mode. After that I called my kernel from memory address 0x1000. Everything is working perfectly as I can even print text to the screen by writing to memory address 0xb8000.My main question is this:
How do I switch to video(pixel plotting) mode from my kernel in protected mode. I know how to do this from 16 bits real mode from my boot loader by setting register ah to 0x00 and al to 0x13 then calling interrupt 0x10 but I have no idea of how to go about this from c code in protected mode. Help of any kind would be greatly appreciated. Thanks in advance
Additional information: I am using NASM to compile assembly code and Cygwin gcc to compile c code.

Michael Petch
  • 42,023
  • 8
  • 87
  • 158
preciousbetine
  • 2,849
  • 3
  • 13
  • 26
  • 3
    [VBE has a PM interface](https://wiki.osdev.org/VESA_Video_Modes) that lets you change the video mode, among other things. It's a bit cumbersome, especially if you are not confident with the GDT; so if it's a one-time change it's better to do it while in RM. If you plan to change the video settings regularly, then VBE is the only standardised interface. Modern OSes have specific drivers that took a huge amount of man-hours to code. – Margaret Bloom Nov 24 '18 at 12:03
  • I think I found a way to change the mode by writing directly to the Vga controller. But I also read that vbe supports higher resolutions. Can you link me to any site on vbe programming? – preciousbetine May 20 '19 at 17:36
  • Yes, programming the VGA will only give you low resolution mode. I would start from the VBE specification but they may be a bit technical. Try googling "VBE specification", something interesting seems to pop up. Otherwise Intel HD Graphics adapters have open datasheet and opensource driver for Linux but that is definitively a very hard way. – Margaret Bloom May 20 '19 at 18:18
  • At last, I had to drop back to real mode to change the video mode. But I think it has no negative effect on the performance of my OS since it was done in the early stage. Anyway, thanks for your responses. – preciousbetine Sep 14 '19 at 16:04

0 Answers0