Last time I encountered a problem with the 1024x256x256color vesa mode, which I got the solution. This time I got struck in a new problem. First of all,let me make things clear.
I've been writing real mode DOS like 16 bit OS with GUI and extended mode support. I've been trying to implement GUI switching from 265 colors to True colors and vice versa.I've now been able to implement the 256 colors properly but when I switched to 24bit Vesa mode(using inline assembly in kernel) I'd encountered the following problem:
1.When I implement the putpixel function it is able to display only 3 colors & I think those colors are red, white and cyan(not sure though).I know I've passed the color bytes to the video memory properly(i.e 8bits red, 8bits green and 8bits blue) but even then any mixture of these color bytes donot output desired color.
2.When I output a pixel to (2,0) it displays a red color at that place.Following that if i output a pixel to (3,0) it displays cyan color again at (2,0). And again if I output a pixel to (4,0) it displays white color at again (2,0). Now if output a pixel to (5,0) then only the pixel moves one place right with the initial color red.This continues with every pixels. Moreover the origin(0,0) is also shifted to some place at right. What's going on?
I'm sorry to write long explanations but it because short explanation can't make things clear. Please Help.
24bit vesa mode is not working properly [SOLVED]
24bit vesa mode is not working properly [SOLVED]
Last edited by Chandra on Wed Sep 29, 2010 7:23 am, edited 1 time in total.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
-
- Member
- Posts: 116
- Joined: Wed Oct 22, 2008 2:21 am
- Location: Roma,Italy
Re: 24bit vesa mode is not working properly
Hello
Your calculation of memory address is wrong...
This is true:
Your calculation of memory address is wrong...
This is true:
Code: Select all
Pixel 2,0:
Memory OFFSET 0 1 2 3 4 5 6 7 8
x x x x x x B G R
Pixel 3,0:
Memory OFFSET 0 1 2 3 4 5 6 7 8 9 10 11
x x x x x x x x x B G R
Pixel 4,0:
Memory OFFSET 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
x x x x x x x x x x x x B G R
Pixel 5,0:
Memory OFFSET 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
x x x x x x x x x x x x x x x B G R
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: 24bit vesa mode is not working properly
Each pixel in video memory is stored in three consecutive bytes (i.e. 24 bits). Based on your description, you are somehow trying to write all three color bytes to the same memory byte. Check that you're incrementing the pointer after plotting each channel, or doing something equivalent with offsets, and spacing the pixels three bytes apart.
Re: 24bit vesa mode is not working properly
Thanks guys. Now,will you please tell me what is the mode no. for 32 bit colors mode. I tried mode 0x138 but it didn't worked with bochs or qemu. If anybody knows please tell me.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
-
- Member
- Posts: 76
- Joined: Sun Dec 14, 2008 1:53 pm
Re: 24bit vesa mode is not working properly
There's information on Wikipedia which contains a large table of possible values for mode numbers, but you shouldn't rely on them. Starting with VBE 2, VESA deprecated the process of assigning or using standard mode numbers; your code has to use the BIOS or some other way to enumerate all the video modes and pick the best one. The OSDev Wiki has some information about that in the VBE entry.