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.
So, I've switched to 800x600x32 mode, and tried to fill screen with white color.
Hovewer, it doesn't work for some reason, maybe I am wrong? Please help me.
Thanks, Awe2K.
Octocontrabass wrote:Did you switch to a mode with a linear frame buffer? If not, you'll have to flip between pages in the frame buffer in order to fill the entire screen.
I've used GRUB to switch mode (specified in multiboot header).
Does vid_mem point to the correct address?
Yes, it is 0xA0000
Awe2K wrote:800x600x32
unsigned where = x * 3 + y * 2400;
How many bytes are 32 bits? How many bits are in 3 bytes?
Yes, I know 32 bits is for 4 bytes, and 3 bytes are 24 bits. But if I change 3 to 4 and 2400 to 3200, then it just gets worse.
A framebuffer at 800x600x32 is about 1.8 megabytes. There is only 128 kilobytes of address space available for a framebuffer at that address. You either have the wrong address or you aren't using a LFB mode.
Awe2K wrote:Yes, I know 32 bits is 4 bytes, and 3 bytes are 24 bits. But if I change 3 to 4 and 2400 to 3200, then it just gets worse.
That's because you're actually in a 24bpp mode, not 32bpp.
I know that setting video mode manually won't give linear frame buffer.But I thought grub does so. Or I have to switch back to real mode and set this mode manually?
Awe2K wrote:I know that setting video mode manually won't give linear frame buffer.But I thought grub does so. Or I have to switch back to real mode and set this mode manually?
If the "video mode number" that GRUB told you it used (in the multi-boot information structure) has bit 14 set (which is very likely) then the video mode is using LFB; and in that case you've probably got the address 0xA0000 from the wrong part of the VBE mode information structure (e.g. from the "window A base address" field and not from the "LFB base address" field).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Awe2K wrote:I know that setting video mode manually won't give linear frame buffer.But I thought grub does so. Or I have to switch back to real mode and set this mode manually?
If the "video mode number" that GRUB told you it used (in the multi-boot information structure) has bit 14 set (which is very likely) then the video mode is using LFB; and in that case you've probably got the address 0xA0000 from the wrong part of the VBE mode information structure (e.g. from the "window A base address" field and not from the "LFB base address" field).
Brendan wrote:If the "video mode number" that GRUB told you it used (in the multi-boot information structure) has bit 14 set (which is very likely) then the video mode is using LFB; and in that case you've probably got the address 0xA0000 from the wrong part of the VBE mode information structure (e.g. from the "window A base address" field and not from the "LFB base address" field).
But if bit 14 is not set, how do I achieve that?
If bit 14 isn't set, then GRUB is buggy and you're mostly screwed. You'd either have to refuse to boot, switch to real mode and set a video mode yourself to work around the problem, or setup segments for (one of) VBE's protected mode interfaces so that you can do bank switching (and write code that switches banks whenever it needs to access a different 64 KiB bank of display memory).
Of course it's extremely likely that bit 14 is set.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.