What are "VGA-compatible boards and VGA-compatible modes"?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Cyao
Member
Member
Posts: 78
Joined: Tue Jun 07, 2022 11:23 am
Libera.chat IRC: Cyao
Location: France
Contact:

What are "VGA-compatible boards and VGA-compatible modes"?

Post by Cyao »

I have just switched to VGA graphics mode in 16 bit mode using mov ah, 0x00, mov al, 0x13 and int 0x10. And I went to 32 bit mode.

Now I want to draw stuff on the screen, and I found a documentation saying there is these few methods:
  • Use protected-mode code to program the VGA directly, without using the BIOS. This works only with VGA-compatible video boards and VGA-compatible video modes.
  • Add a virtual 8086 mode monitor (VMM) to your OS. Call the BIOS mode-set interrupt in virtual 8086 mode.
  • Switch from pmode to real mode, call the BIOS mode-set interrupt in real mode, then return to pmode.
  • Write a protected-mode driver specifically for the SVGA chip used in your video board. Someone else who wants to use your OS must have the same video board (or they must write a new driver for their own video board).
  • Call VBE 3.x BIOS functions in 16-bit protected mode. Few video cards support VBE 3.x.
I am choosing the first one (cuz it looks like the easiest), so I am wondering what are "VGA-compatible video boards and VGA-compatible video modes"? And am I choosing the best method?
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: What are "VGA-compatible boards and VGA-compatible modes

Post by nullplan »

If you have switched to a graphics mode using VBE, then you have a framebuffer base address, and you can just write stuff there, whatever the mode of the CPU. That list is more pertaining to switching the video mode after switching to protected or long mode.

VGA-compatible boards would be the original 1987 IBM VGA card and all of its clones. Chances are, if you had one, you would know. And VGA-compatible modes are at most 640x480 with 16 colors at 60Hz. The hardware could not handle more. If you have one of those cards, the register documentation is leaked, so you can just find out the required values to write to the card to make it do whatever you want. However, keep in mind the limitations.

The other options given are for using basically any other card and using VBE to set the video mode. It is mostly enough to just set the video mode in real mode and use the given base address from then on. Bear in mind that nVidia has had a long-standing feud with VBE and deliberately hampered their VBE implementations.

I would start with the above option (use VBE or GOP (on a UEFI computer) to set up a frame buffer and then just use that) until the impossibility to change video modes becomes too annoying, then write a graphics driver for the actual card in my computer. All major manufacturers have at least some documentation available, or else you may peek at open-source drivers. Since I have yet to get to that point, I can offer no advice.
Carpe diem!
Cyao
Member
Member
Posts: 78
Joined: Tue Jun 07, 2022 11:23 am
Libera.chat IRC: Cyao
Location: France
Contact:

Re: What are "VGA-compatible boards and VGA-compatible modes

Post by Cyao »

Thanks for your advice! I'm also going to use the frame buffer then.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: What are "VGA-compatible boards and VGA-compatible modes

Post by Octocontrabass »

cyao1234 wrote:what are "VGA-compatible video boards and VGA-compatible video modes"?
Most display adapters are VGA-compatible. If you can use INT 0x10 to change the video mode, your display adapter is VGA-compatible. VGA-compatible video modes are the ones supported by the original IBM VGA from 1987, which means up to 640x480 and up to 256 colors (but not at the same time).
cyao1234 wrote:And am I choosing the best method?
The best method is to have your bootloader set up a linear framebuffer. That way, you don't need to worry about VGA compatibility or BIOS/UEFI differences outside your bootloader.
Post Reply