Hi,
MadZarx wrote:Brendan wrote:That's probably not a good idea either; because GOP (on UEFI) doesn't support text modes.
In general, the most sane method is to use firmware services to output characters very early during boot (e.g. either "int 0x10, ax=0x0E" for BIOS or the "EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL" on UEFI), then use whatever firmware provides to switch to a graphics mode that uses a linear framebuffer during boot (e.g. either VBE on BIOS or UGA/GOP on UEFI). After boot you'd use the (already setup) framebuffer, until/unless you load a native video driver.
You mean I change to rmode to call BOIS instructions
oh not again
No, I mean do this when you're still in the CPU mode that the firmware expects, before you switch to a CPU mode that the firmware doesn't expect. This means:
- for BIOS, setup a video mode while you're in real mode (before you switch to protected or long mode)
- for 64-bit UEFI, setup a video mode while you're in long mode (before you switch to protected mode, if its a 32-bit OS)
- for 32-bit UEFI (if you bother), setup a video mode while you're in protected mode (before you switch to long mode, if its a 64-bit OS)
Of course if you're using multi-boot, then you have no control over what happens before the boot loader starts your OS and have to use whatever the multi-boot boot loader provides (even if "whatever the multi-boot boot loader provides" is completely useless and broken).
MadZarx wrote:I have heard about how easy it is to work with UEFI and call its functions in C. But my machine is an old one that have BIOS on a chip. So I can't support UEFI yet, ultil I buy a new laptop
Not really - most emulators support UEFI now (at least VMware, VirtualBox and Qemu do).
MadZarx wrote:Brendan wrote:These OSs have native drivers for almost all modern video cards, where the video card manufacturer writes the driver for their card. For ATI and NVidia on Linux (where the driver written by the manufacturer is a closed source/proprietary driver) there's also open source drivers as an alternative.
So the manufacturers write their video drivers for other OSs
I've seen some video drivers in linux kernel source which there was a dirver for Nvidia. Is that the thing that linux uses?
Maybe. Video on Linux is a massive "cluster bork" with different pieces strewn all over the place (some in kernel, some in other places in kernel, some in different libraries like MESA, etc), where different pieces are used/unused depending on situation and kernel configuration. I'm not a Linux developer and probably wouldn't know if/when whatever you were looking at is used (even if I did know exactly what you were looking at).
MadZarx wrote:Brendan wrote:It's possible to have a video driver that contains code for several video cards. This makes sense when the differences between them are minor (e.g. slightly different models, where 99% of the code is the same for both).
If your driver is a massive thing that supports both Intel and Nvidia, then yes. In practice these video devices are very different, so it doesn't make any sense for the same driver to support both.
So the codes for different models are 99% same. I will just need something to change the resolution and enable 2D acceleration and nothing more
But I'm sure it will be a hard job for me cuz I have no experience in writing video drivers
My "99%" figure was not extremely accurate measurement, does not apply to all "slightly different models" and doesn't apply to any "very different models". How much variation there is between different models of one manufacturers video card depends on the specific models (e.g. there might be no difference at all between model xyz1234 and model xyz1235, but model xyz1235 and model 1236 might be very different).
MadZarx wrote:Is there a way to detect the video card brand and model? Like using something like cpuid?
I think you need to forget about writing native video drivers until you've implemented some of the fundamental pieces of the OS that everything else relies on (including things like PCI bus enumeration, which will tell you the vendor and model of every PCI device).
Cheers,
Brendan