OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:31 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Some VBE documentation or example?
PostPosted: Tue Jun 30, 2015 1:13 pm 
Offline

Joined: Tue Jun 30, 2015 1:01 pm
Posts: 3
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.

:)


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Tue Jun 30, 2015 1:43 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
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

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Tue Jun 30, 2015 2:05 pm 
Offline

Joined: Tue Jun 30, 2015 1:01 pm
Posts: 3
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?


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Tue Jun 30, 2015 2:09 pm 
Offline

Joined: Tue Jun 30, 2015 1:01 pm
Posts: 3
I found a resource: http://www.brokenthorn.com/Resources/OSDevVid2.html
But i couldn't understand it.
It requires some functions not in tutorial.


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Tue Jun 30, 2015 3:57 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
CPPOS wrote:
I found a resource: http://www.brokenthorn.com/Resources/OSDevVid2.html
But i couldn't understand it.
It requires some functions not in tutorial.

I've looked through that. It tells you to use BIOS interrupts, doesn't it?

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Tue Jun 30, 2015 10:55 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
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

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Wed Jul 01, 2015 12:22 am 
Offline
Member
Member

Joined: Thu Sep 20, 2012 5:11 am
Posts: 69
Location: germany hamburg
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
Quote:
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


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Wed Jul 01, 2015 2:41 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 543
Location: Shahpur, Layyah, Pakistan
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.)


Top
 Profile  
 
 Post subject: Re: Some VBE documentation or example?
PostPosted: Thu Jul 02, 2015 9:24 am 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Quote:
I found a resource: http://www.brokenthorn.com/Resources/OSDevVid2.html
But i couldn't understand it.
It requires some functions not in tutorial.

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?

_________________
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group