0

How can i access vesa modes via IO/Port for x86 CPU? I already tried a code which works only on Bosch

private static void SetVideoMode(ushort width, ushort height, ushort depth)
{    
    WriteCommand(0x4, 0x00);
    WriteCommand(0x1, width);
    WriteCommand(0x2, height);
    WriteCommand(0x3, depth); 
    WriteCommand(0x4, 0x1 | 0x40 );
    PortIO.Outb(0x3c0, 0x20);
}
Michael
  • 57,169
  • 9
  • 80
  • 125
amaneureka
  • 1,150
  • 11
  • 26
  • language, platform missing.. any tag to know what you're talking about? – dendini Dec 19 '13 at 14:22
  • You need to include the definition of `WriteCommand` in your question, otherwise we have no idea what your code is doing. – Michael Dec 19 '13 at 18:09

1 Answers1

3

You can't. VESA (VBE) is a standard BIOS driver framework which provides a single interface to disparate video cards.

To directly poke at the I/O ports or memory-mapped registers you will either need to restrict yourself to basic VGA modes and functionality or know the precise details of your particular video card.

This, of course, was the problem VBE was designed to solve in the first place.

doynax
  • 4,285
  • 3
  • 23
  • 19
  • Exactly, I am a developer of Atom OS (www.atomos.tk), We are making operating system in c# using own compiler in c#, And I want to implement VESA/VBE how can i? – amaneureka Dec 20 '13 at 09:32
  • You will need a thunking mechanism for calling 16-bit real-mode functions, BIOS interrupts in this case. You will also need to map the resulting physical memory into your address space somehow. Take a peek at how basic fallback disk I/O and VGA graphics drivers are implemented, VBE should be similar – doynax Dec 20 '13 at 10:01
  • I don't get what you exactly want to say...Can you please help me in implementing that? on our compiler...I'll be very thankful :D – amaneureka Dec 21 '13 at 10:35
  • x86 processors have been around since the 70s and at this point system programming is a (rotting) onion of compatibility layers. You may not call the VBE functions from normal 32-bit protected mode introduced in 1985, rather you must switch the processor to the 16-bit virtual 8086 mode. To do this you will need to set up set up a call gate in the global descriptor table to a 16-bit trampoline function invoking VBE interrupt, take care to call from the lower 16-bits of a selector, etc. This is all covered in excruciating detail in volume 3 of the Intel Architecture Manuals – doynax Dec 21 '13 at 10:56
  • In other words talk to whoever is handling the low-level virtual memory management and bootstrapping code. They should be able to help you out in getting a VBE call across and map the frame buffer back in – doynax Dec 21 '13 at 10:58