Video Modes.
Video Modes.
Hello all,
I want to switch to a resolution, such as 640x480. I am sort of new to this video use other than text. I read that I could use VESA. What is this? How do I use it in C? My kernel booted from GRUB, so, as far as I can tell, I would need to call an BIOS interrupt. I find that this isn't possible in PMODE. How do I get around this? Any thought, suggestions, ect.
Brett
I want to switch to a resolution, such as 640x480. I am sort of new to this video use other than text. I read that I could use VESA. What is this? How do I use it in C? My kernel booted from GRUB, so, as far as I can tell, I would need to call an BIOS interrupt. I find that this isn't possible in PMODE. How do I get around this? Any thought, suggestions, ect.
Brett
Re:Video Modes.
First this code in asm (i do not use C) for geting into vesa 640x480x256.
This is for vesa 1 (banking)i can give you the code for vesa 2 linear if you want ,But this is good to start with.
You set vesa up in real mode,I have herad that people hack into to grub code to do this,But I do not use grubs, so i do not know how.
In my OS i set VESA in real mode befor go to pmode,i will swich back to unreal mode to change modes.
May be with grubs you can swich to unreal mode,these lots of tut's to do this:
http://www.karig.net/0004.html
I use "bootprog" for my loader you can get it here:
http://alexfru.chat.ru/epm.html
The zip to get is call "bootprog.zip".
ASHLEY4.
Code: Select all
mov ax,4f02h? ;set vesa 1.0 screen mode
mov bx,101h? ;640*480*256
int 10h
mov dx,0xa000
mov ds,dx? ? ? ? ? ? ? ;sets up registers
call window
rain:
xor dx,dx? ? ? ;(pages-1)
mouse:
push dx
call window
xor bx,bx
mov al, 0cch
call dog
pop dx
cmp dx,4
je rain
inc dx
mov ah,01h
int 16h
jz mouse
mov ax,0003h
int 10h
mov ax,4c00h? ? ? ; This is just
int 21h? ? ? ? ? ? ? ? ; for test ,take it out in your OS
window:
mov ax,4f05h? ? ;vesa 1 window select
mov bx,0
int 10h? ? ? ? ;dx is? the reqired window
xor bx,bx
ret
dog:? ? ? ? ;(4*2^16)+45056 pixels
mov [bx],al
inc bx
cmp bx,$00000
jne dog
ret
You set vesa up in real mode,I have herad that people hack into to grub code to do this,But I do not use grubs, so i do not know how.
In my OS i set VESA in real mode befor go to pmode,i will swich back to unreal mode to change modes.
May be with grubs you can swich to unreal mode,these lots of tut's to do this:
http://www.karig.net/0004.html
I use "bootprog" for my loader you can get it here:
http://alexfru.chat.ru/epm.html
The zip to get is call "bootprog.zip".
ASHLEY4.
Re:Video Modes.
hi,
I think you are in protected mode. So there is no way you can do it using interrupt. One way to do in protected mode is to use dpmi extender But that is not going to work because you are implementing your own os(not using windows).
(Please inform me if i am wrong.)
One way is to do use memort mapped i/o and write to A0000. You can use bank switching to use high resolution.
You can read this faq to if you want to learn more on it.
http://www.faqs.org/faqs/pc-hardware-fa ... ogramming/
regards virusX
I think you are in protected mode. So there is no way you can do it using interrupt. One way to do in protected mode is to use dpmi extender But that is not going to work because you are implementing your own os(not using windows).
(Please inform me if i am wrong.)
One way is to do use memort mapped i/o and write to A0000. You can use bank switching to use high resolution.
You can read this faq to if you want to learn more on it.
http://www.faqs.org/faqs/pc-hardware-fa ... ogramming/
regards virusX
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video Modes.
You basically have 3 options:
- make a trip to (un)real after GRUB set up pmode and issue your VESA calls there
- implement a VM86 monitor and use it to call the VESA stuff
- try to detect the pmode VBE entry point which will give you access to a pmode-compatible VESA interface ... provided that your hardware offers it :-/
and finally,
- hook GRUB at some point before it enters pmode and switch video mode there
- make a trip to (un)real after GRUB set up pmode and issue your VESA calls there
- implement a VM86 monitor and use it to call the VESA stuff
- try to detect the pmode VBE entry point which will give you access to a pmode-compatible VESA interface ... provided that your hardware offers it :-/
and finally,
- hook GRUB at some point before it enters pmode and switch video mode there
Re:Video Modes.
Or you could set it to that mode using I/O registers, some people would disapprove this though.Pype.Clicker wrote: You basically have 3 options:
- make a trip to (un)real after GRUB set up pmode and issue your VESA calls there
- implement a VM86 monitor and use it to call the VESA stuff
- try to detect the pmode VBE entry point which will give you access to a pmode-compatible VESA interface ... provided that your hardware offers it :-/
and finally,
- hook GRUB at some point before it enters pmode and switch video mode there
Re:Video Modes.
It's not so much that we'd disapprove as that we'd question your sanity. Different video cards have radically different hardware, and while some of the more basic VGA functions are emulated, most are going to be different from card to card, requiring a different driver for each card - not each family, each separate model. Furthermore, most manufacturers keep the information required to do so a trade secret, which means that in order to determine how to write the driver for it, you'd need to either sign a deal with the manufacturer involving an NDA and signing over rights to the source code to them, or else spend a year or so reverse-engineering the API.
It was precisely to avoid this kind of nightmare - which was SOP in the early and mid 1990s - that the VESA standard was promulgated in the first place. The VBE acts as a common API for accessing the higher-end functions of each card, one which works regardless of the manufacturer. While it's true that most manufacturers still put out their own specialized drivers for performance reasons, they only support the common OSes - the various versions of Windows, and maybe Linux if you are lucky. The VESA standard means that you can at least use the cards even without the specific driver for it.
C&CW.
It was precisely to avoid this kind of nightmare - which was SOP in the early and mid 1990s - that the VESA standard was promulgated in the first place. The VBE acts as a common API for accessing the higher-end functions of each card, one which works regardless of the manufacturer. While it's true that most manufacturers still put out their own specialized drivers for performance reasons, they only support the common OSes - the various versions of Windows, and maybe Linux if you are lucky. The VESA standard means that you can at least use the cards even without the specific driver for it.
C&CW.
Re:Video Modes.
Only those smart people forgot about one thing: pmode OS'sThe VESA standard means that you can at least use the cards even without the specific driver for it.
Of course, you could use it before switching to p. mode, or even better (available in vesa 3.0), when in p.mode to switch it, using some variables, and using a jump pointer.
I'm going to create a few graphical drivers, using I/O ports, because VESA 3.0 is too new for my computer (which means that my computer doesn't have).
So my suggestion stays: use I/O ports.
But there's only one disadvantage: the different standards
Re:Video Modes.
@Dennis have you seen this site, i have not down load the demo, But it looks interesting.
http://www.gameprogrammer.com/3-tweak.html
ASHLEY4.
http://www.gameprogrammer.com/3-tweak.html
ASHLEY4.
Re:Video Modes.
Pretty good actually, just downloaded itASHLEY4 wrote: @Dennis have you seen this site, i have not down load the demo, But it looks interesting.
http://www.gameprogrammer.com/3-tweak.html
ASHLEY4.
I downloaded a few good documentations from Giesers site: www.execpc.com/~geezer
I think if you search good, you'll find it
Re:Video Modes.
like pype said, find the VBE pmode entry point. It is simple and explained in the VBE docs.Pype.Clicker wrote: You basically have 3 options:
- make a trip to (un)real after GRUB set up pmode and issue your VESA calls there
- implement a VM86 monitor and use it to call the VESA stuff
- try to detect the pmode VBE entry point which will give you access to a pmode-compatible VESA interface ... provided that your hardware offers it :-/
and finally,
- hook GRUB at some point before it enters pmode and switch video mode there
It is called through 16bit protected mode segments that you must setup.
Re:Video Modes.
This is only available in VESA 3.0 and up as mentioned in the VESA docs.mr. xsism wrote:like pype said, find the VBE pmode entry point. It is simple and explained in the VBE docs.Pype.Clicker wrote: You basically have 3 options:
- make a trip to (un)real after GRUB set up pmode and issue your VESA calls there
- implement a VM86 monitor and use it to call the VESA stuff
- try to detect the pmode VBE entry point which will give you access to a pmode-compatible VESA interface ... provided that your hardware offers it :-/
and finally,
- hook GRUB at some point before it enters pmode and switch video mode there
It is called through 16bit protected mode segments that you must setup.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video Modes.
okay, Dennis, just consider this:
using I/O programming directly, all you can get is 320x200x256 or 640x480x16 at best. 320x200 is barely enough to display a splashscreen and 640x480x16 is *really* a pain to deal with (ask someone who tried )
For other mode, as they're *not* standard VGA, you *cannot* set them up by accessing standard VGA registers ... I don't see the advantage of enabling 320x200 or 640x480 over staying in text mode, personnally ...
using I/O programming directly, all you can get is 320x200x256 or 640x480x16 at best. 320x200 is barely enough to display a splashscreen and 640x480x16 is *really* a pain to deal with (ask someone who tried )
For other mode, as they're *not* standard VGA, you *cannot* set them up by accessing standard VGA registers ... I don't see the advantage of enabling 320x200 or 640x480 over staying in text mode, personnally ...
Re:Video Modes.
You're right.Pype.Clicker wrote: okay, Dennis, just consider this:
using I/O programming directly, all you can get is 320x200x256 or 640x480x16 at best. 320x200 is barely enough to display a splashscreen and 640x480x16 is *really* a pain to deal with (ask someone who tried )
For other mode, as they're *not* standard VGA, you *cannot* set them up by accessing standard VGA registers ... I don't see the advantage of enabling 320x200 or 640x480 over staying in text mode, personnally ...
(Or like the French would say: Vous etes raison )
Unless, you debug the BIOS ;D
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video Modes.
if you're ready to disassemble the video BIOS (which you of course are not allowed to do ) and use the result for reverse-engineering the specs of the card without making it burning or something, i sincerely suggest you use that energy to offer a vm86 monitor instead: at least it will offer support for *all* video cards :-p
... or study something like 2D driver for another open-source OS and implement a hardware-specific driver on that basis.
oh, and btw, Frenchies say "Vous avez raison"
... or study something like 2D driver for another open-source OS and implement a hardware-specific driver on that basis.
oh, and btw, Frenchies say "Vous avez raison"