Page 2 of 3

Re: How in the world do you set up a GUI??

Posted: Tue Jan 31, 2012 10:00 am
by zhiayang
Mano wrote:Well, I was looking for an easy way to change the video mode. On wiki there's a list of possible ways of doing it, and it's in order of dificulty. Because I'm using GRUB, interrupts won't do. So I decided to search how to patch Grub, and I've found a pre-built patched GRUB on this topic.

I downloaded the stage2_eltorito, replaced it, and changed my menu.lst file. All I did was actually to add a line after the kernel command:

Code: Select all

vbeset XXX
Where XXX is the hex value related to the mode you want. To find out which value to put, I just pressed C to enter grub's command line, and typed the command:

Code: Select all

vbeprobe
It worked for me at least. Anyway, I don't think this is really useful. I still think it's better to study and try to code my own vga driver.


Right. So now it says "Blackcomb ... lala" and "0x118: Direct colour, 1024x768x24". So I assume I did everything correctly? But when I get into my OS, it's still the console screen.

Re: How in the world do you set up a GUI??

Posted: Tue Jan 31, 2012 12:19 pm
by Mano
requimrar wrote: Right. So now it says "Blackcomb ... lala" and "0x118: Direct colour, 1024x768x24". So I assume I did everything correctly? But when I get into my OS, it's still the console screen.
I believe you replaced the stage2_eltorito, and that's why you're seeing the patched Grub screen. But, did you change your menu.lst file?

Here's how mine is:

Code: Select all

default=0
timeout=30
title MY_SO
foreground bbbbbb
background 000000
kernel /boot/kernel.bin root=/dev/hda2 
vbeset 0x146 #code for video mode obtained with vbeprobe command on GRUB command line.

Re: How in the world do you set up a GUI??

Posted: Tue Jan 31, 2012 4:57 pm
by zhiayang
Mano wrote:
requimrar wrote: Right. So now it says "Blackcomb ... lala" and "0x118: Direct colour, 1024x768x24". So I assume I did everything correctly? But when I get into my OS, it's still the console screen.
I believe you replaced the stage2_eltorito, and that's why you're seeing the patched Grub screen. But, did you change your menu.lst file?

Here's how mine is:

Code: Select all

default=0
timeout=30
title MY_SO
foreground bbbbbb
background 000000
kernel /boot/kernel.bin root=/dev/hda2 
vbeset 0x146 #code for video mode obtained with vbeprobe command on GRUB command line.

OHHHH... I just put 118. DERP. thanks.




EDIT: So this means that I need to restart to change graphics mode? Or is it possible to switch back to text mode?

Re: How in the world do you set up a GUI??

Posted: Tue Jan 31, 2012 8:25 pm
by bubach
you should be able to get back to text mode without BIOS use, like:
http://bos.asmhackers.net/docs/vga_with ... _5/vga.php

becasue mode 0x3 is basic VGA and the same on all computers with VGA support. but that's a one time deal. no way to go back and forth between VGA and VESA modes unless using methods previously mentioned.
but it still might come in handy to have a mode switch for panic screens, just like the BSOD. :)

Re: How in the world do you set up a GUI??

Posted: Wed Feb 01, 2012 12:51 am
by Owen
Switching back from a VBE mode to a VGA mode requires using the VBE BIOS (Some GPUs don't require it, but the only reliable method is to go through the BIOS)

Re: How in the world do you set up a GUI??

Posted: Wed Feb 01, 2012 4:03 am
by bubach
My bad, assumed stuff I shouldn't.

Re: How in the world do you set up a GUI??

Posted: Wed Feb 01, 2012 1:12 pm
by DavidCooper
Owen wrote:Switching back from a VBE mode to a VGA mode requires using the VBE BIOS (Some GPUs don't require it, but the only reliable method is to go through the BIOS)
Could you clarify something about that please - when switching back from a VBE mode to a VGA mode, is there ever a problem with using the older BIOS method of selecting a VGA mode (al=0, ah=mode) as opposed to the VBE method where you make ax = 4f02h? When you refer to the VBE BIOS it sounds as if you may be ruling out the former method, though that's probably accidental as you are obviously focussed on making a point about using the BIOS as opposed to not using the BIOS).

Re: How in the world do you set up a GUI??

Posted: Wed Feb 01, 2012 1:56 pm
by turdus
Guys, guys... you are totally wrong.
First of all, there's no way to tell which mode will be set for a given vbe code on different machines (for resolutions introduced after 1994 at least). But you really should know it, because switching to text mode without VBE BIOS (using VGA registers) is only possible for certain modes (see RBIL Table 00080 bit 5, homework: find and read documentation). Owen is almost right, he's way is safer and bulletproof.

Re: How in the world do you set up a GUI??

Posted: Wed Feb 01, 2012 2:07 pm
by Combuster
Owen wrote:Some GPUs don't require it
Not using the BIOS at all to disable a VBE mode will fail in the vast majority of cases. That is because all cards have separate registers that deal with bitfields beyond the VGA's capability, and none of the ones I have seen have a lucky "VGA compatible bit" within the VGA register file. Worse, some video cards share parts of the register files and in the worst case you can burn out your monitor or overclock your card to hell if you try.
because switching to text mode without VBE BIOS (using VGA registers) is only possible for certain modes
I.e., modes you don't need VBE for and a quality VGA driver can do on its own. Which essentially makes the BIOS a requirement for all realistic uses of VBE. :wink:

The official part is more interesting in that regard: VBE does not define a way to return to a legacy mode as those modes do not need to exist (the card may not be VGA). It does however declare that:
the 8-bit value returned by VGA BIOS Function 0Fh (it is up to the OEM to
define this number), must correctly reinitialize the graphics mode through VGA BIOS Function
00h.
In other words, the Video BIOS must be able to set a video mode with legacy function 0, and besides that, all DOS apps of old use just that function to get back to text mode before exiting. Technically you are still dealing with a VBE BIOS as a whole.

Re: How in the world do you set up a GUI??

Posted: Wed Feb 01, 2012 2:12 pm
by turdus
Combuster wrote:Not using the BIOS at all to disable a VBE mode will fail in the vast majority of cases, and that is because all cards have separate registers that deal with bitfields beyond the VGA's capability, and none of the ones I have seen have a lucky "VGA compatible bit" within the VGA register file.
I can confirm that. Never saw any 32 bit lfb bigger than 1024x768 that had the bit set.

Re: How in the world do you set up a GUI??

Posted: Sun Feb 05, 2012 8:22 am
by Yashas
May i know actually what do u want in GUI.Text,VideoMode,Bitmap or something else.Becaz i had made mine , i can give some bit of my code.

Re: How in the world do you set up a GUI??

Posted: Sun Feb 05, 2012 12:00 pm
by Unkn0wn1
Preferably not CP'd from somewhere or other.

Seriously, I need a disk image of his OS. Just to laugh when it turns out he's lying...

Re: How in the world do you set up a GUI??

Posted: Sun Feb 05, 2012 5:35 pm
by zhiayang
Unkn0wn1 wrote:Preferably not CP'd from somewhere or other.

Seriously, I need a disk image of his OS. Just to laugh when it turns out he's lying...
Indeed, indeed. But in that sense some source code would prove to be more useful. Also... I'm not one to discriminate based on someones age (I'm 16 anyway), but that guys only 13, and that's suspicious. I mean, if you have so much driver support, graphics etc, why would you need to copy the barebones keyboard driver?

Either way, back on topic;
so I get grub to switch modes okay,
but using the pixel plotting code from the wiki, I can't get anything on screen. I do remember once where I managed to get 2 random pixels on screen, but I can't reproduce it

What address do I give putpixel for the *screen pointer? The standard 0xB8000 (if I remember correctly), or what?

Also, what do the colours go by, is it the standard 0x00 to 0xFF or something else?


Ps: I don't mean to offend anyone, I'm just more on the cynical side...

Re: How in the world do you set up a GUI??

Posted: Sun Feb 05, 2012 7:40 pm
by gerryg400
requimrar wrote:
Unkn0wn1 wrote:Preferably not CP'd from somewhere or other.

Seriously, I need a disk image of his OS. Just to laugh when it turns out he's lying...
Indeed, indeed. But in that sense some source code would prove to be more useful. Also... I'm not one to discriminate based on someones age (I'm 16 anyway), but that guys only 13, and that's suspicious. I mean, if you have so much driver support, graphics etc, why would you need to copy the barebones keyboard driver?

Either way, back on topic;
so I get grub to switch modes okay,
but using the pixel plotting code from the wiki, I can't get anything on screen. I do remember once where I managed to get 2 random pixels on screen, but I can't reproduce it

What address do I give putpixel for the *screen pointer? The standard 0xB8000 (if I remember correctly), or what?

Also, what do the colours go by, is it the standard 0x00 to 0xFF or something else?


Ps: I don't mean to offend anyone, I'm just more on the cynical side...
You get the frame_buf_ptr from the mode info block for the mode you choose. It's often near the top of the 32bit address space.

Re: How in the world do you set up a GUI??

Posted: Mon Feb 06, 2012 6:58 am
by zhiayang
gerryg400 wrote:You get the frame_buf_ptr from the mode info block for the mode you choose. It's often near the top of the 32bit address space.
Yes, but that requires I be in real mode (at least according to the wiki); I'm using grub.