Author Topic: how to switch video modes (switching to VESA video modes too) in protected mode  (Read 18811 times)

Offline lukassevc

  • Jr. Member
  • *
  • Posts: 5
Hi, I am Lukas,
and I am writing my operating system but I have problem with switching video modes ( switching to VESA modes too ) because I don't know how to do it and I don't found any tutorial on it so I need help. I know that in real mode it can by done by using ah = 0x00 and with interruption 0x10, but I am in protected mode so I don't know how to do it. Can someone help me please?
Thanks for any help!

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 387
  • Country: br
http://www.petesqbsite.com/sections/tutorials/tuts/vbe3.pdf

See "Obtaining the Protected Mode Entry Point", page 21 -- this is NOT available in all implementations and I was never been able to make it work properly...

Offline lukassevc

  • Jr. Member
  • *
  • Posts: 5
http://www.petesqbsite.com/sections/tutorials/tuts/vbe3.pdf

See "Obtaining the Protected Mode Entry Point", page 21 -- this is NOT available in all implementations and I was never been able to make it work properly...

I read it, and it seems to that it can work properly, but can you please tell me how to do it in C language?
Thanks!

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 387
  • Country: br
I read it, and it seems to that it can work properly, but can you please tell me how to do it in C language?
I could, but I thought this forum was about assembly language, isn't it?

Offline ace012k8

  • New Member
  • Posts: 1
I ran into the same headache back when I was experimenting with writing a small OS kernel for fun. Switching to VESA modes in protected mode easily becomes a rabbit hole. I had to do a bunch of hacks just to get the BIOS to cooperate. The legacy BIOS interrupt (INT 0x10) just won't fly once you're out of real mode, so I remember relying on setting up a trampoline to call into real mode temporarily or using something like a VBE 2.0+ Linear Framebuffer approach after querying video modes beforehand.

For videos and demo recording, I always used a lightweight editor to polish up footage or build quick walkthroughs. If you’re working on dev-related content and want to make clean quick edits, especially on Windows, I picked up a solid one here: https://www.movavi.com/imovie-for-windows/. Easy to use and doesn’t overcomplicate things.
« Last Edit: April 11, 2025, 08:41:07 AM by ace012k8 »

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 387
  • Country: br
I ran into the same headache back when I was experimenting with writing a small OS kernel for fun. Switching to VESA modes in protected mode easily becomes a rabbit hole. I had to do a bunch of hacks just to get the BIOS to cooperate. The legacy BIOS interrupt (INT 0x10) just won't fly once you're out of real mode, so I remember relying on setting up a trampoline to call into real mode temporarily or using something like a VBE 2.0+ Linear Framebuffer approach after querying video modes beforehand.
Yep... OR you could setup and use Virtual 8086 mode (NOT available in x86-64 mode!) to do it... Anyway, it is a nightmare.

Another problems are: Getting the Linear Framebuffer Physical address from ModeBlockInfo strucuture... Often this field is zeroed in VMs like QEMU, for example... And page switching, for double buffering... another nightmare.

This and the Protect Mode Interface, described in VBE 3.0 documentation usually are not present (not even in Option-ROM that a nVidia card puts there)...

Offline marknoble

  • Jr. Member
  • *
  • Posts: 3
For VESA in protected mode, you gotta use VBE functions, not BIOS interrupts. Check the VBE specs on OSDev wiki for mode info and framebuffer setup. It’s tricky but doable. What bootloader you using? Might help narrow it down.