From 738b285e622254dd6e34573bc0112a3e2571f70d Mon Sep 17 00:00:00 2001 From: 0x35c Date: Mon, 9 Dec 2024 10:06:57 +0100 Subject: [PATCH] =?UTF-8?q?feature:=20vbe=20can=20now=20display=20pixels?= =?UTF-8?q?=20to=20the=20screen=20=F0=9F=A5=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/multiboot.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/multiboot.c b/src/multiboot.c index ed54d3d..cb2adf6 100644 --- a/src/multiboot.c +++ b/src/multiboot.c @@ -1,6 +1,7 @@ #include #include +#include "commands.h" #include "debug.h" #include "kpanic.h" #include "memory.h" @@ -30,22 +31,20 @@ static void init_mmap(multiboot_info_t *mbd_virt, size_t *pt_index) static void init_vbe(multiboot_info_t *mbd_virt) { - const uint32_t framebuffer_size = mbd_virt->framebuffer_height * - mbd_virt->framebuffer_width * - CEIL(mbd_virt->framebuffer_bpp, 4); + const uint32_t framebuffer_size = + mbd_virt->framebuffer_height * mbd_virt->framebuffer_pitch; uint32_t i = 0; for (; i < CEIL(framebuffer_size, PAGE_SIZE); i++) { - if (i % 1024 == 0) - page_directory[800 + i / 1024] = - ((uint32_t)vbe_page_table - HEAP_END) | 0x03; vbe_page_table[i % 1024] = ((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) | INIT_FLAGS; } - display.buff = (uint32_t *)GET_PAGE_ADDR(800 + i - 1 / 1024, 0) + + page_directory[800] = ((uint32_t)vbe_page_table - HEAP_END) | 0x03; + display.buff = (uint32_t *)GET_PAGE_ADDR(800, 0) + (mbd_virt->framebuffer_addr % PAGE_SIZE); display.height = mbd_virt->framebuffer_height; display.width = mbd_virt->framebuffer_width; + display.pitch = mbd_virt->framebuffer_pitch; display.bpp = mbd_virt->framebuffer_bpp; }