VGA/VESA ???

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Sam111
Member
Member
Posts: 385
Joined: Mon Nov 03, 2008 6:06 pm

VGA/VESA ???

Post by Sam111 »

Ok , I have my kernel in protected mode and wrote to display text to the screen using the MMIO
base address 0xB8000 works fine.

I think the display is 80x24 text mode (just got to remember the even array elements are for the characters and the odd ones are for their color/text attributes...etc :D )

I am wondering how I can switch modes to graphics 1024 x 720 or so?
I have read thru the http://pdos.csail.mit.edu/6.828/2008/re ... e/vbe3.pdf

But most of this stuff works with the int 10h interrupt in real mode. Their should be away to do all this stuff in protected mode. ( I would like it if I didn't have to switch back to real mode everytime I have to set the graphics display setting to something different)

I am pretty lost what spec's I have to look at for doing a driver program.
I saw in one osdev post that 0xA0000 was used for graphics mode (curious on how this can be used and how to set the resolution with this if possible for graphics mode)

I am using NVidia card on AGP bus

Thanks
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: VGA/VESA ???

Post by pcmattman »

Virtual 8086 mode or x86emu works.

However, I consider the following to be prerequisites before you even think about anything other than text-based modes:
  • Proper memory management: virtual memory and a physical memory manager. Paging that works.
  • Processes and threads: required for a virtual 8086 mode task anyway, and processes and threads are a fundamental part of most operating systems
  • Some form of driver interface: abstract away important driver functionality. Something like CDI or UDI helps, but both require OS support which you might not want to write
  • A decent userspace. The main reason I say this is that by the time you reach proper graphics modes, you should already prove that your kernel actually works. Easiest way to do that: run applications in userspace, preferably some that use threads.
Only after you've completed the above prerequisites should you start thinking about graphics modes and things like that. After all, if your foundations aren't stable and secure, the beautiful mansion will topple down eventually :)

EDIT: Also, following the above prerequisites teaches you fundamental skills which you absolutely need to know when implementing any type of graphical interface.

EDIT 2:
I am using NVidia card on AGP bus
My suggestion is to not even try. To my knowledge there is absolutely no documentation about the nVidia cards, and therefore you're stuck either reverse engineering the card (illegal in some countries) or trying to comprehend some open source driver (which would have to be ported to your driver interface, a monolithic task).

VESA is good enough for what you want to do, and it's supported by a massive range of cards.
Last edited by pcmattman on Sun Mar 28, 2010 7:26 pm, edited 1 time in total.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: VGA/VESA ???

Post by Gigasoft »

Usage of non-VGA functionality is different for each display device, and it's often undocumented. So, either you must use VGA compatible modes, or write drivers for specific display device, or go back to real mode (or Virtual 8086 mode) and use VBE.

This page describes the operation of a display device in VGA mode:
http://www.stanford.edu/class/cs140/pro ... ga/vga.htm
User avatar
Sam111
Member
Member
Posts: 385
Joined: Mon Nov 03, 2008 6:06 pm

Re: VGA/VESA ???

Post by Sam111 »

Well I kind of just wanted to beable to display a picture in 1024 x 720 resolution
Or beable to draw a picture on the screen other then text.
User avatar
KotuxGuy
Member
Member
Posts: 96
Joined: Wed Nov 25, 2009 1:28 pm
Location: Somewhere within 10ft of my favorite chubby penguin!

Re: VGA/VESA ???

Post by KotuxGuy »

I seem to remember you having trouble with linking(http://forum.osdev.org/viewtopic.php?f=13&t=21753 & http://forum.osdev.org/viewtopic.php?f=13&t=21750), and those posts were just 3 days ago. There is no way that you should be trying to handle VGA/VESA right now.

And please, please, try to be a little more specific with your subject. It really helps those who can help you.
Look at this: What order should i make things in at the "For the starter" section. I doubt you have all that stuff already implemented.

Then, and only then, should you come back to us asking about VGA/VESA. And before you ask, look through the wiki, like James T. Klik.

EDIT: You need to do some more research: http://wiki.osdev.org/VGA_Hardware#Color_Logic. I found that in 30 seconds.
EDIT #2: There is no 80x24 or 1024x720 mode, that should be 80x25 and 1024x768 mode.

P.S to the mods: Could we rename "What order should i make things in" to "What order should I make things in"? It's grammatically correct :?
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory :D )
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: VGA/VESA ???

Post by Combuster »

I might add, straight from the FAQ (-1 you): http://wiki.osdev.org/How_do_I_set_a_graphics_mode
P.S to the mods: Could we rename "What order should i make things in" to "What order should I make things in"? It's grammatically correct :?
Did you notice one is a redirect for the other - designed for those people who are too lazy to find the shift key :wink: - Also, wiki editing doesn't need mod privileges
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
KotuxGuy
Member
Member
Posts: 96
Joined: Wed Nov 25, 2009 1:28 pm
Location: Somewhere within 10ft of my favorite chubby penguin!

Re: VGA/VESA ???

Post by KotuxGuy »

Yeah, I know wiki editing doesn't require a mod. I just wanted to make sure no one would be mad at my modifying. BTW, I didn't know about that redirect. #-o
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory :D )
User avatar
TheDragon
Member
Member
Posts: 43
Joined: Mon Aug 25, 2008 8:23 pm
Location: Middle of Nowhere

Re: VGA/VESA ???

Post by TheDragon »

If you want to look at some rather good VGA tutorials, I would suggest that you look at Denthor's Asphixia VGA Trainer (Grand name, isn't it?). I think it has something that you are looking for in one of the tutorials, somewhere. Ummm...I thought you could find them at gamedev.net, but apparently they are closed for some reason. Google around for them.

While his tutorials aren't exactly on the OS level (they are coded in Pascal, after all), they are rather informative, and they contain ASM snippets that you might be able to learn from. However, they mostly cover techniques like scrolling and fire demos and stuff.

It's worth a shot.
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

Re: VGA/VESA ???

Post by ehenkes »

I think the display is 80x24 text mode

Typically you start with 80*25 text mode using two bytes for each character.

This will help you to have 80*50 text mode which helps a little bit until you have developed your high resolution OS.
You can use it during real mode stage (e.g. boot loader stage 1).

Code: Select all

    ; set 80x50 text mode and 8x8 font
    mov ax, 0x1112
    xor bl, bl
    int 0x10
Post Reply