From 9dc527b3be9d493dcf8cf1baf78477373eb5990d Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 26 Apr 2021 12:37:34 +0200 Subject: Enable psf font for framebuffer display --- src/drivers/framebuffer.cc | 70 ++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 49 deletions(-) (limited to 'src/drivers/framebuffer.cc') diff --git a/src/drivers/framebuffer.cc b/src/drivers/framebuffer.cc index 2fbe153..2ac47db 100644 --- a/src/drivers/framebuffer.cc +++ b/src/drivers/framebuffer.cc @@ -1,58 +1,30 @@ #include "framebuffer.hpp" +#include "core/paging.hpp" +#include "libs/string.hpp" -#define MAX_COL 80 -#define MAX_LINE 25 +FB_CFG fb_cfg; -VIDEO_STATE VS={ - (u8 *)0xB8000, - 0, - 0, - BLACK, - GRAY, -}; -void putchar(char c){ - // Handle newline here - if(c=='\n'){ - VS.col=0; - VS.line+=1; - if(VS.line>=MAX_LINE){ - VS.line=MAX_LINE-1; - scrollup(); - } - return; - } - - // Print char - VS.mem[VS.col*2+MAX_COL*VS.line*2]=c; - VS.mem[VS.col*2+MAX_COL*VS.line*2+1]=VS.fg|VS.bg<<4; - - // Refresh location - VS.col+=1; - if(VS.col>= MAX_COL){ - VS.col=0; - VS.line+=1; - if(VS.line>=MAX_LINE){ - VS.line=MAX_LINE-1; - scrollup(); - } - } +void framebuffer_init(FB_CFG config){ + fb_cfg=config; } -void clear(){ - for(u8 i=0;i