Page 1 of 1
Some VBE documentation or example?
Posted: Tue Jun 30, 2015 1:13 pm
by CPPOS
Hi forum. I'm a new member.
I'm developing a Real Mode Simple GUI OS for hobby in C++
In normal VGA i have only 320x200 and 256 color support.
I tried my VBE driver get it to work, but i couldn't.
I need an example for VBE or a better SVGA driver.
Can anyone make and share a very simple OS in C++ only including VBE driver (Setmode, Putpixel, Getpixel, etc...) and an example?
Thanks. I really really need it. Please.
Re: Some VBE documentation or example?
Posted: Tue Jun 30, 2015 1:43 pm
by Brendan
Hi,
CPPOS wrote:Can anyone make and share a very simple OS in C++ only including VBE driver (Setmode, Putpixel, Getpixel, etc...) and an example?
It's not possible. The calling conventions that the BIOS (and VBE) use are different, so you need to use assembly and therefore it can't be done with C++ only. I'm also not aware of any C++ compiler that's capable of generating code that works in real mode (excluding ancient/obsolete compilers from last century, but even those probably require DOS).
Also note that for higher resolution/SVGA modes you typically want to use a linear frame buffer so you can access all of the pixels without messy and slow bank switching, and this can't be done in real mode (the address of the linear frame buffer is always too high to reach with real mode addressing). For acceptable performance you'd also want a buffer in RAM (which will cost more memory than you can access in real mode for all but saddest video modes).
Note: It is possible to switch between (e.g.) real mode and protected mode; where almost all of your code runs in 32-bit protected mode (and you only switch back to real mode to use the BIOS). This solves most of the problems with limited addressing/memory while also making it so you can use modern compilers, but means you're not using real mode.
Finally, "Getpixel" should never be used for anything ever (reading from display memory is very slow), and "Putpixel" should probably also never be used (it's far faster to use higher level primitives like "PutCharacter", "PutLine", "Put Rectangle", etc).
Cheers,
Brendan
Re: Some VBE documentation or example?
Posted: Tue Jun 30, 2015 2:05 pm
by CPPOS
Brendan wrote:Hi,
CPPOS wrote:Can anyone make and share a very simple OS in C++ only including VBE driver (Setmode, Putpixel, Getpixel, etc...) and an example?
It's not possible. The calling conventions that the BIOS (and VBE) use are different, so you need to use assembly and therefore it can't be done with C++ only. I'm also not aware of any C++ compiler that's capable of generating code that works in real mode (excluding ancient/obsolete compilers from last century, but even those probably require DOS).
Also note that for higher resolution/SVGA modes you typically want to use a linear frame buffer so you can access all of the pixels without messy and slow bank switching, and this can't be done in real mode (the address of the linear frame buffer is always too high to reach with real mode addressing). For acceptable performance you'd also want a buffer in RAM (which will cost more memory than you can access in real mode for all but saddest video modes).
Note: It is possible to switch between (e.g.) real mode and protected mode; where almost all of your code runs in 32-bit protected mode (and you only switch back to real mode to use the BIOS). This solves most of the problems with limited addressing/memory while also making it so you can use modern compilers, but means you're not using real mode.
Finally, "Getpixel" should never be used for anything ever (reading from display memory is very slow), and "Putpixel" should probably also never be used (it's far faster to use higher level primitives like "PutCharacter", "PutLine", "Put Rectangle", etc).
Cheers,
Brendan
Thanks for your post.
I was using Turbo C++ compiler runs in dos, real mode.
Okay, how to make a Simple SVGA OS in C++ and Assembly?
Re: Some VBE documentation or example?
Posted: Tue Jun 30, 2015 2:09 pm
by CPPOS
I found a resource:
http://www.brokenthorn.com/Resources/OSDevVid2.html
But i couldn't understand it.
It requires some functions not in tutorial.
Re: Some VBE documentation or example?
Posted: Tue Jun 30, 2015 3:57 pm
by Roman
I've looked through that. It tells you to use BIOS interrupts, doesn't it?
Re: Some VBE documentation or example?
Posted: Tue Jun 30, 2015 10:55 pm
by Brendan
Hi,
CPPOS wrote:I was using Turbo C++ compiler runs in dos, real mode.
Yes - an ancient C++ compiler from 25 years ago that won't even run on modern systems (e.g. with 64-bit Windows) and probably has to be used inside an emulator like DOSbox.
CPPOS wrote:Okay, how to make a Simple SVGA OS in C++ and Assembly?
You probably want to start with reading these pages, in order:
Cheers,
Brendan
Re: Some VBE documentation or example?
Posted: Wed Jul 01, 2015 12:22 am
by freecrac
Hello.
Some puplic and costfree documents from vesa.org (need register/login):
vbe3.pdf
EEDIDguideV1.pdf
EEDIDverifGuideRa.pdf
But wihin DOSbox we can only use outdated VBE modenumbers from VBE 1.x, but not the modenumbers of a VBE2 or VBE3 bios from a modern display device, example for to switch into a widescreen resolution of 1920x1200 (16:10 aspect ratio).
In the simplest form for to access the linear framebuffer we can additional use the 16 bit big-realmode.
https://en.wikipedia.org/wiki/Unreal_mode
To put an 80386 or higher microprocessor into unreal mode, a program must first enter protected mode, find or create a flat descriptor in the GDT or LDT, load some of the data segment registers with the respective protected mode "selector", and then switch back to real mode. After returning to real mode, the processor will continue using the cached descriptors as established in protected mode, thus allowing access to 4 GiB of "extended" memory from real mode.
Bresenham line routine for the linear framebuffer with 8 bpp
http://board.flatassembler.net/topic.php?t=16530
Dirk
Re: Some VBE documentation or example?
Posted: Wed Jul 01, 2015 2:41 am
by Muazzam
CPPOS wrote:Hi forum. I'm a new member.
You're welcome.
CPPOS wrote:
[...]
I need an example for VBE or a better SVGA driver.
[...]
Can anyone make and share a very simple OS.
[...]
Thanks. I really really need it. Please.
[...]
Just an advice, please stop saying 'I need it.' Really, we don't care whether you need anything or not. Moreover, it is not a raw beginners' forum. And yes, we don't have time to make you an OS and share it. Learn to learn on your own and search information on the Internet. These are excellent pages:
http://wiki.osdev.org/Beginner_Mistakes,
http://wiki.osdev.org/Required_Knowledge. (And also
http://www.google.com, if you don't know.)
Re: Some VBE documentation or example?
Posted: Thu Jul 02, 2015 9:24 am
by neon
Hello,
With regards to VBE, the only methods that were not described in the tutorial were opted out due to their implementations being specific to the software system. E.g. The software can either drop down to real mode to call the BIOS (in the case of a boot loader) or enter virtual 8086 mode which requires basic multitasking and user mode support. Since you are already running in real mode using a deprecated compiler (however one that can certainly generate code for system software) you should be able to just call the BIOS directly. E.g. implement your own
int86 method that calls the BIOS.
With the above in mind, What is it exactly that you are uncertain of? Are you not sure how to call the BIOS? The
vbe3.pdf document provided earlier contains all of the information on VBE and was written quite well. Did you already look over it?