Readed, but how to get pixelwidth? In VBE Mode Info structure there's no this entry.omarrx024 wrote:Read this carefully.
Setting VBE modes with GRUB2
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
- BrightLight
- Member

- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Setting VBE modes with GRUB2
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".
EDIT: Forgot to say this, "pixelwidth" is just "bitdepth/8".
You know your OS is advanced when you stop using the Intel programming guide as a reference.
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
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".
-
glauxosdever
- Member

- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
Re: Setting VBE modes with GRUB2
Hi,
Regards,
glauxosdever
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
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
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
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
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;
-
glauxosdever
- Member

- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
Re: Setting VBE modes with GRUB2
Hi,
Regards,
glauxosdever
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
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
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
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
Is anybody here? I still have this problem.
- abcdef4bfd
- Member

- Posts: 492
- Joined: Fri Apr 03, 2015 9:41 am
Re: Setting VBE modes with GRUB2
Close the thread, I'll create new named "Putting pixels in VBE 1024*768*32 mode".