[Closed] Setting VESA/VBE Mode

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
DeezRamChips
Member
Member
Posts: 132
Joined: Fri Apr 08, 2016 5:03 am
Location: atapio.cpp - why won't you work :(
Contact:

Re: Setting VESA/VBE Mode

Post by DeezRamChips »

I meant plotting a pixel :D
User avatar
DeezRamChips
Member
Member
Posts: 132
Joined: Fri Apr 08, 2016 5:03 am
Location: atapio.cpp - why won't you work :(
Contact:

Re: Setting VESA/VBE Mode

Post by DeezRamChips »

At the right position.
Look what happens:
Image
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Setting VESA/VBE Mode

Post by Octacone »

DeezRamChips wrote:At the right position.
Look what happens:
Image
lol, is that a bug?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
DeezRamChips
Member
Member
Posts: 132
Joined: Fri Apr 08, 2016 5:03 am
Location: atapio.cpp - why won't you work :(
Contact:

Re: Setting VESA/VBE Mode

Post by DeezRamChips »

Well, when you ask grub setting a video mode it can't handle, it set's it to the highest resolution mode possible (wich is 1600x1200x32)

here is a list of the standard GRUB video modes:
http://pierre.baudu.in/other/grub.vga.modes.html
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Setting VESA/VBE Mode

Post by Octacone »

DeezRamChips wrote:Well, when you ask grub setting a video mode it can't handle, it set's it to the highest resolution mode possible (wich is 1600x1200x32)

here is a list of the standard GRUB video modes:
http://pierre.baudu.in/other/grub.vga.modes.html
Yeah I see, I set my mode to 1280x768x32 and it works fine.
By the way, how do you fill you init function. Do you save ebx to a special struct and then call init with those struct values or what?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
dseller
Member
Member
Posts: 84
Joined: Thu Jul 03, 2014 5:18 am
Location: The Netherlands
Contact:

Re: Setting VESA/VBE Mode

Post by dseller »

Maybe you can use some kind of instant messaging application instead of using the forum as a chatroom?
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Setting VESA/VBE Mode

Post by Octacone »

dseller wrote:Maybe you can use some kind of instant messaging application instead of using the forum as a chatroom?
That is a very good idea.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
DeezRamChips
Member
Member
Posts: 132
Joined: Fri Apr 08, 2016 5:03 am
Location: atapio.cpp - why won't you work :(
Contact:

Re: Setting VESA/VBE Mode

Post by DeezRamChips »

in my loader:

Code: Select all

push ebx ; push the multiboot header
push eax ; push the magic numba !
call kstart ; call kernel
in my file types.h, I have the multibootheader structure:

Code: Select all

struct boot_info {
	uint32 flags;
	uint32 mem_lower;
	uint32 mem_upper;
	uint32 boot_device;
	uint32 cmdline;
	uint32 mods_count;
	uint32 mods_addr;
	uint32 num;
	uint32 size;
	uint32 addr;
	uint32 shndx;
	uint32 mmap_length;
	uint32 mmap_addr;
	uint32 drives_length;
	uint32 drives_addr;
	uint32 config_table;
	uint32 boot_loader_name;
	uint32 apm_table;
	uint32 vbe_control_info;
	uint32 vbe_mode_info;
	uint16 vbe_mode;
	uint16 vbe_interface_seg;
	uint16 vbe_interface_off;
	uint16 vbe_interface_len;
	uint64 framebuffer_addr;
	uint32 framebuffer_pitch;
	uint32 framebuffer_width;
	uint32 framebuffer_height;
	uint8 framebuffer_bpp;
	uint8 framebuffer_type;
	union
	{
		struct
		{
			uint32 framebuffer_palette_addr;
			uint16 framebuffer_palette_num_colors;
		};
		struct
		{
			uint8 framebuffer_red_field_position;
			uint8 framebuffer_red_mask_size;
			uint8 framebuffer_green_field_position;
			uint8 framebuffer_green_mask_size;
			uint8 framebuffer_blue_field_position;
			uint8 framebuffer_blue_mask_size;
		};
	};
};
and in my kernel, I have:

Code: Select all

struct boot_info *boot_information;

void kstart(int eax_magic, struct boot_info *mboot){
	boot_information = mboot;
	if(eax_magic!=0x2BADB002)
    {
        panic(itoa(eax_magic));
    }
	else{
		init(mboot->framebuffer_addr, mboot->framebuffer_pitch, mboot->framebuffer_width, mboot->framebuffer_height, mboot->framebuffer_bpp, 1024, 768);
	}
	main();
}
Simple ^_^
User avatar
DeezRamChips
Member
Member
Posts: 132
Joined: Fri Apr 08, 2016 5:03 am
Location: atapio.cpp - why won't you work :(
Contact:

Re: Setting VESA/VBE Mode

Post by DeezRamChips »

It's easyier to post the code here than in a app like skype
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Setting VESA/VBE Mode

Post by Octacone »

DeezRamChips wrote:in my loader:

Code: Select all

push ebx ; push the multiboot header
push eax ; push the magic numba !
call kstart ; call kernel
in my file types.h, I have the multibootheader structure:

Code: Select all

struct boot_info {
	uint32 flags;
	uint32 mem_lower;
	uint32 mem_upper;
	uint32 boot_device;
	uint32 cmdline;
	uint32 mods_count;
	uint32 mods_addr;
	uint32 num;
	uint32 size;
	uint32 addr;
	uint32 shndx;
	uint32 mmap_length;
	uint32 mmap_addr;
	uint32 drives_length;
	uint32 drives_addr;
	uint32 config_table;
	uint32 boot_loader_name;
	uint32 apm_table;
	uint32 vbe_control_info;
	uint32 vbe_mode_info;
	uint16 vbe_mode;
	uint16 vbe_interface_seg;
	uint16 vbe_interface_off;
	uint16 vbe_interface_len;
	uint64 framebuffer_addr;
	uint32 framebuffer_pitch;
	uint32 framebuffer_width;
	uint32 framebuffer_height;
	uint8 framebuffer_bpp;
	uint8 framebuffer_type;
	union
	{
		struct
		{
			uint32 framebuffer_palette_addr;
			uint16 framebuffer_palette_num_colors;
		};
		struct
		{
			uint8 framebuffer_red_field_position;
			uint8 framebuffer_red_mask_size;
			uint8 framebuffer_green_field_position;
			uint8 framebuffer_green_mask_size;
			uint8 framebuffer_blue_field_position;
			uint8 framebuffer_blue_mask_size;
		};
	};
};
and in my kernel, I have:

Code: Select all

struct boot_info *boot_information;

void kstart(int eax_magic, struct boot_info *mboot){
	boot_information = mboot;
	if(eax_magic!=0x2BADB002)
    {
        panic(itoa(eax_magic));
    }
	else{
		init(mboot->framebuffer_addr, mboot->framebuffer_pitch, mboot->framebuffer_width, mboot->framebuffer_height, mboot->framebuffer_bpp, 1024, 768);
	}
	main();
}
Simple ^_^
Very similar structure, please lets use inbox instead of this topic.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Setting VESA/VBE Mode

Post by glauxosdever »

Hi,


Please do some research before posting.

And do not post every 2 minutes.

Regards,
glauxosdever
Last edited by glauxosdever on Tue Oct 18, 2016 1:19 pm, edited 1 time in total.
dseller
Member
Member
Posts: 84
Joined: Thu Jul 03, 2014 5:18 am
Location: The Netherlands
Contact:

Re: Setting VESA/VBE Mode

Post by dseller »

DeezRamChips wrote:It's easyier to post the code here than in a app like skype
This might be true. But you are annoying the rest of the forum users by doing so.

I also hope that you will learn that the easiest route is not necessarily the best.
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Setting VESA/VBE Mode

Post by Octacone »

dseller wrote:
DeezRamChips wrote:It's easyier to post the code here than in a app like skype
This might be true. But you are annoying the rest of the forum users by doing so.

I also hope that you will learn that the easiest route is not necessarily the best.
We are using private messenger so please guys stop. This topic is [CLOSED]
Admins can you please mark this topic as closed/answered?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Setting VESA/VBE Mode

Post by sortie »

thehardcoreOS, I see from your Makefile that you are not using a cross-compiler. If that's still the case, you might want to read these wiki articles:

http://wiki.osdev.org/Bare_Bones
http://wiki.osdev.org/GCC_Cross-Compiler
http://wiki.osdev.org/Why_do_I_need_a_Cross_Compiler%3F
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Setting VESA/VBE Mode

Post by Octacone »

sortie wrote:thehardcoreOS, I see from your Makefile that you are not using a cross-compiler. If that's still the case, you might want to read these wiki articles:

http://wiki.osdev.org/Bare_Bones
http://wiki.osdev.org/GCC_Cross-Compiler
http://wiki.osdev.org/Why_do_I_need_a_Cross_Compiler%3F
Hey sortie, I am not using gcc cross-compiler because it refused to build, I was getting some strange errors while building it...
It is a real pain to make it work since you need to manually move and install all those binutils.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Post Reply