NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: lukassevc on May 16, 2019, 06:23:51 AM

Title: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: lukassevc on May 16, 2019, 06:23:51 AM
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!
Title: Re: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: fredericopissarra on May 16, 2019, 11:43:33 AM
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...
Title: Re: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: lukassevc on May 16, 2019, 03:58:44 PM
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!
Title: Re: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: fredericopissarra on May 17, 2019, 12:29:30 PM
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?
Title: Re: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: ace012k8 on April 09, 2025, 01:00:47 PM
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/ (https://www.movavi.com/imovie-for-windows/). Easy to use and doesn’t overcomplicate things.
Title: Re: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: fredericopissarra on April 13, 2025, 01:01:59 PM
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)...
Title: Re: how to switch video modes (switching to VESA video modes too) in protected mode
Post by: marknoble on April 25, 2025, 04:37:33 PM
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.