From 5ee43c6e9f22cc22257686f176fe91f85a174d5e Mon Sep 17 00:00:00 2001 From: Jarkko Toivanen Date: Thu, 21 Sep 2023 20:01:24 +0300 Subject: [PATCH] Made the framebuffer support both 24 and 32 bpp --- src/framebuffer.c | 9 ++++++++- src/kernel.c | 20 ++++++++++++++++---- src/start32.s | 5 ++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/framebuffer.c b/src/framebuffer.c index 29f6b9d..5fc0f6c 100644 --- a/src/framebuffer.c +++ b/src/framebuffer.c @@ -20,5 +20,12 @@ void initfb(unsigned long addr, unsigned short w, unsigned short h, unsigned cha void putpixel(unsigned short x, unsigned short y, unsigned char r, unsigned char g, unsigned char b, unsigned char a) { if (x>fb_width || y> fb_height) return; - *((unsigned long *)(fb_address + y*fb_pitch + x*fb_bytespp)) = r<framebuffer_height; y++) { - for(x=0; x < mbootinfo->framebuffer_width; x++) { - putpixel(x, y, 0, c, c, 0xff); + //serial_write_string("\n"); + for (;c<255;c+=5) { + //serial_write_string("/"); + for(y=0; y < mbootinfo->framebuffer_height; y++) { + for(x=0; x < mbootinfo->framebuffer_width; x++) { + putpixel(x, y, 0, c, c, 0xff); + } + } + } + //serial_write_string("\n"); + for (;c>0;c-=5) { + //serial_write_string("\\"); + for(y=mbootinfo->framebuffer_height; y>=0; y--) { + for(x=mbootinfo->framebuffer_width; x>=0; x--) { + putpixel(x, y, 0, c, c, 0xff); + } } } - c+=4; } serial_write_string("\nExecution finished, halting...\n"); diff --git a/src/start32.s b/src/start32.s index da0207a..32e185d 100644 --- a/src/start32.s +++ b/src/start32.s @@ -21,8 +21,8 @@ .long 0 # bss end address .long 0 # entry address .long 0 # video mode_type (0:fb, 1:txt) (set flags[2]!) - .long 1024 # video width - .long 768 # video height + .long 640 # video width + .long 480 # video height .long 32 # video depth .bss @@ -46,4 +46,3 @@ _start: cli 1: hlt jmp 1b -#include "lol.s"