Re: Setting VBE modes with GRUB2
Posted: Sat Oct 17, 2015 4:44 am
Readed, but how to get pixelwidth? In VBE Mode Info structure there's no this entry.omarrx024 wrote:Read this carefully.
The Place to Start for Operating System Developers
https://f.osdev.org/
Readed, but how to get pixelwidth? In VBE Mode Info structure there's no this entry.omarrx024 wrote:Read this carefully.
I don't know assembly memory access, so what I should do?omarrx024 wrote:The VBE mode information structure contains the width in pixels, height in pixels, bitdepth in bits, which should be 1024x768x32 as it is what you're using. The pitch means bytes per line. You need to use that as well. My GitHub repository has some graphical code in kernel/gdi.asm and kernel/vesa.asm. It's in assembly language, but shouldn't be too hard to convert to C.
EDIT: Forgot to say this, "pixelwidth" is just "bitdepth/8".
For a start, check out the multiboot info structure here, the one described in the multiboot specification is severely outdated. Then try to write some code which will be able to put pixels. If you don't seem to get it right, see here. But, please, try your best before asking here again, and when you get it working, please understand if it is working properly or not, and why happens that.catnikita255 wrote:I don't know assembly memory access, so what I should do?omarrx024 wrote:The VBE mode information structure contains the width in pixels, height in pixels, bitdepth in bits, which should be 1024x768x32 as it is what you're using. The pitch means bytes per line. You need to use that as well. My GitHub repository has some graphical code in kernel/gdi.asm and kernel/vesa.asm. It's in assembly language, but shouldn't be too hard to convert to C.
EDIT: Forgot to say this, "pixelwidth" is just "bitdepth/8".
OK.glauxosdever wrote:Hi,
For a start, check out the multiboot info structure here, the one described in the multiboot specification is severely outdated. Then try to write some code which will be able to put pixels. If you don't seem to get it right, see here. But, please, try your best before asking here again, and when you get it working, please understand if it is working properly or not, and why happens that.catnikita255 wrote:I don't know assembly memory access, so what I should do?omarrx024 wrote:The VBE mode information structure contains the width in pixels, height in pixels, bitdepth in bits, which should be 1024x768x32 as it is what you're using. The pitch means bytes per line. You need to use that as well. My GitHub repository has some graphical code in kernel/gdi.asm and kernel/vesa.asm. It's in assembly language, but shouldn't be too hard to convert to C.
EDIT: Forgot to say this, "pixelwidth" is just "bitdepth/8".
Regards,
glauxosdever
Code: Select all
unsigned long pixindex=y*vbeMode.pitch+x*(vbeMode.bpp/8);
framebuffer[pixindex+0]=color;
framebuffer[pixindex+1]=color>>8;
framebuffer[pixindex+1]=color>>16;
Well, what have you tried until now? You say it's not working, what are the exact results?catnikita255 wrote:Nothing is working. Code of putpixel:Code: Select all
unsigned long pixindex=y*vbeMode.pitch+x*(vbeMode.bpp/8); framebuffer[pixindex+0]=color; framebuffer[pixindex+1]=color>>8; framebuffer[pixindex+1]=color>>16;
I tried only this, and my mind are not having any other solvings of this problem. Nothing is displaying, just black screen.glauxosdever wrote:Hi,
Well, what have you tried until now? You say it's not working, what are the exact results?catnikita255 wrote:Nothing is working. Code of putpixel:Code: Select all
unsigned long pixindex=y*vbeMode.pitch+x*(vbeMode.bpp/8); framebuffer[pixindex+0]=color; framebuffer[pixindex+1]=color>>8; framebuffer[pixindex+1]=color>>16;
Regards,
glauxosdever