OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Video Modes.
PostPosted: Sat Apr 10, 2004 4:21 pm 
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


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sat Apr 10, 2004 4:48 pm 
First this code in asm (i do not use C) for geting into vesa 640x480x256.
Code:
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

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.


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 12:58 am 
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


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 3:33 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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 ;)

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 5:10 am 
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 ;)


Or you could set it to that mode using I/O registers, some people would disapprove this though.


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 11:17 am 
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.


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 1:21 pm 
Quote:
The VESA standard means that you can at least use the cards even without the specific driver for it.

Only those smart people forgot about one thing: pmode OS's
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 :(


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 1:44 pm 
@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.


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 1:56 pm 
ASHLEY4 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.

Pretty good actually, just downloaded it
I downloaded a few good documentations from Giesers site: www.execpc.com/~geezer
I think if you search good, you'll find it :)


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Sun Apr 11, 2004 11:58 pm 
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 ;)



like pype said, find the VBE pmode entry point. It is simple and explained in the VBE docs.

It is called through 16bit protected mode segments that you must setup.


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Mon Apr 12, 2004 1:32 am 
For 640x480x16 there is code in the OSD http://my.execpc.com/~geezer/osd under graphics

Pete


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Mon Apr 12, 2004 4:38 am 
mr. xsism wrote:
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 ;)



like pype said, find the VBE pmode entry point. It is simple and explained in the VBE docs.

It is called through 16bit protected mode segments that you must setup.

This is only available in VESA 3.0 and up as mentioned in the VESA docs.


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Mon Apr 12, 2004 6:52 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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 ...

_________________
Image May the source be with you.


Top
 Profile  
 
 Post subject: Re:Video Modes.
PostPosted: Mon Apr 12, 2004 7:59 am 
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 ...



You're right.
(Or like the French would say: Vous etes raison ;) )
Unless, you debug the BIOS ;D


Top
  
 
 Post subject: Re:Video Modes.
PostPosted: Mon Apr 12, 2004 8:24 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 2:31 am
Posts: 5964
Location: In a galaxy, far, far away
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" ;)

_________________
Image May the source be with you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 75 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