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.
The QEMU window changes in size, which means that VESA mode is enabled.
According to this article, the video memory address of QEMU is 0xFD000000.
Using
QEMU does not use a fixed address for the framebuffer. Grub will pass the framebuffer address to you in the multiboot struct (and you can also locate it through PCI).
Your memset is wrong. First, memset operates on bytes (at lest on logical level). So your color 0xFF0000 is truncated to byte 0x00.
Second, sizeof operator is used incorrectly. sizeof(0xFD000000) returns 4, which is the same as sizeof(int) So you would change just 4 bytes. You should calculate size of the framebuffer using fomula
Where pitch is number of bytes per scanline (can be found in multiboot_info structure).
Next, 8 bit mode doesn't know about RGB, it uses palette instead. I think 32 bit color would be a better option.
Also assuming fixed framebuffer address (0xFD000000 in your case) is reaaaaly bad thing to do. Proper way here is to parse multiboot_info structure which is pointed to by ebx.
klange wrote:QEMU does not use a fixed address for the framebuffer. Grub will pass the framebuffer address to you in the multiboot struct (and you can also locate it through PCI).
I tried to do it, but it didn't work. I used the code for multiboot info from this site.
I tried to do this: memset((void*)0xFD000000, 0xFF0000, VESA_SIZE);
VESA_SIZE is calculated by this formula VESA_SIZE = VESA_WIDTH * VESA_HEIGHT * VESA_BBP / 8
iansjack wrote:What do you suppose sizeof(0xFD000000) is?
So how many pixels are you setting?
(I can confirm that 0xFD000000 is the correct value for the address of the framebuffer in this case.)
You never pushed the parameters for kmain before calling it. Since you have the magic number first and the multiboot pointer second you'd have to do push ebx then push eax and then do call kmain.
MichaelPetch wrote:You never pushed the parameters for kmain before calling it. Since you have the magic number first and the multiboot pointer second you'd have to do push ebx then push eax and then do call kmain.
I added the code kernel.asm, now it looks like this:
MichaelPetch wrote:Although this code falsely assumes the requested video mode of 800x600x32bpp is the one GRUB set, it should be enough to get you going
Perfectly. Thank you very much, you helped me very much.