Setting VBE modes with GRUB2

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.
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

omarrx024 wrote:Read this carefully. :roll:
Readed, but how to get pixelwidth? In VBE Mode Info structure there's no this entry.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Setting VBE modes with GRUB2

Post by BrightLight »

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".
You know your OS is advanced when you stop using the Intel programming guide as a reference.
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

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".
I don't know assembly memory access, so what I should do?
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Setting VBE modes with GRUB2

Post by glauxosdever »

Hi,

catnikita255 wrote:
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".
I don't know assembly memory access, so what I should do?
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.


Regards,
glauxosdever
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

glauxosdever wrote:Hi,

catnikita255 wrote:
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".
I don't know assembly memory access, so what I should do?
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.


Regards,
glauxosdever
OK.
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

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
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Setting VBE modes with GRUB2

Post by glauxosdever »

Hi,

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;
Well, what have you tried until now? You say it's not working, what are the exact results?


Regards,
glauxosdever
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

glauxosdever wrote:Hi,

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;
Well, what have you tried until now? You say it's not working, what are the exact results?


Regards,
glauxosdever
I tried only this, and my mind are not having any other solvings of this problem. Nothing is displaying, just black screen.
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

Is anybody here? I still have this problem.
User avatar
abcdef4bfd
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am

Re: Setting VBE modes with GRUB2

Post by abcdef4bfd »

Close the thread, I'll create new named "Putting pixels in VBE 1024*768*32 mode".
Post Reply