So I booted my OS into text mode using GRUB2 and printed the vbe info it gave me to the screen. I'm guessing the 80x25 resolution is because I am in text mode, which hopefully would explain why the bpp, pitch, and physbase are 0.
The multiboot header in my bootstrap for this was
Code: Select all
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot
.section .multiboot
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
I made putpixel() that attempts to account for several possible bpps. This would idealy put one whiteish pixel on the screen at x = 0 and y = 0.
The multiboot stuff from the bootstrap this time was
Code: Select all
.set ALIGN, 1<<0
.set MEMINFO, 1<<1
.set VIDINFO, 1<<2
.set FLAGS, ALIGN | MEMINFO | VIDINFO
.set MAGIC, 0x1BADB002
.set CHECKSUM, -(MAGIC + FLAGS)
.section .multiboot
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
.long 0, 0, 0, 0, 0 # Maybe changing these numbers haphazardly will make it work?
.long 0 # or these?
.long 1024, 768, 32 # Maybe I should add ranch dressing? Ranch makes everything better. This is known.
Code: Select all
void putpixel(uint16_t x, uint16_t y, uint32_t* physbase, uint16_t pitch, uint8_t bpp)
{
int loc = (x * bpp) + (y * pitch);
if(bpp == 32 || ((bpp/8) == 31) || ((bpp/8 == 32))){
physbase[loc] = 255;
physbase[loc + 1] = 255;
physbase[loc + 2] = 255;
physbase[loc + 3] = 255;
}
else if(bpp == 24 || ((bpp/8) == 24))
{
physbase[loc] = 255;
physbase[loc + 1] = 255;
physbase[loc + 2] = 255;
}
else if(bpp == 16 || ((bpp/8) == 16))
physbase[loc] = 127 << 8 | 255;
else if(bpp ==15 || ((bpp/8) == 15))
physbase[loc] = 255 << 8 | 255;
}
I'm hoping the problem is in the multiboot header or the putpixel function.
Am I not accounting for enough cases for bpp?
Do I need to cast the physbase as a certain type before I pass it into putpixel()?