Page 1 of 1
Question about VESA addressing
Posted: Tue Oct 09, 2007 9:01 am
by brunsa2
I want to switch to 1024*768*24 or *32. I understand the code from
http://www.osdev.org/wiki/Drawing_In_Protected_Mode , is the address where I would write memory the variable dword physbase? Is it in the form segment:offset? What do I do with it?
Thanks.
Posted: Tue Oct 09, 2007 12:32 pm
by astrocrep
So you have a vm86 mode setup or did you change the graphics mode back in realmode (via a bootloader or such)
First thing you need to do is change the video mode to whatever mode you wish to use.
You'll need vesa 2.0 for that unless you plan of using a hw driver (unlikely) Also would suggest using the Linear Frame Buffer
So using vesa you need to get the vbe data structure for that video mode.
In that structure will give you the base of the video memory...
From them you just write you bytes.
-Rich
Posted: Tue Oct 09, 2007 6:15 pm
by brunsa2
I saw in the tutorial how to get the information. I'll do this in real mode as I load the OS because the console will be implemented in 1024*768 for more space. I just don't know how to address this. Should I load the high 2 bytes into es or something and offset it by the low two bytes. What happens when the length of the LFB is more than 64K? How do I address this? To do this in protected mode, do I just set up a segment descriptor in the GDT with the base at the base of the LFB?
Thanks.
Posted: Tue Oct 09, 2007 6:34 pm
by frank
I don't know if its possible to access the LFB from real mode, for all I know it could be at the 2gb mark or something like that. But remember in protected mode you have access to the whole 4gb address space, once you set up the segments descriptors you more than likely won't have to mess with them again. That being said you could just load the address of the the LFB into a variable and access it like an array. Example (in C)
Code: Select all
DWORD *lfb = address_of_lfb;
lfb[0] = 1; // access first pixel in 32 bit mode.
Posted: Tue Oct 09, 2007 8:18 pm
by brunsa2
How would I address the areas above 64K since the pointer is a dword (16 bits for segment and offset)? 1024*768*24 is 3 megabytes. Also, how would I set up the segment (a level 0 as a data segment with read and write? would I call the function for VBE info and use the address returned as the data for the segment when I make the segment table?)
Posted: Wed Oct 10, 2007 3:13 am
by Combuster
the pointer provided by the bios is a 32-bit physical address. Its not a segment-offset pair or whatsoever. You'll have to use protected mode or unreal mode to be able to access it.