From 457a2117706cdaee34f894e67c89da7bf29f6143 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 12 Apr 2021 10:28:04 +0200 Subject: Refactoring --- src/core/framebuffer.c | 58 ---------------------------------------- src/core/framebuffer.h | 35 ------------------------ src/core/gdt.h | 3 +++ src/core/idt.c | 39 +++++++++++++++++++++++++++ src/core/idt.h | 32 ++++++++++++++++++++++ src/core/int.S | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 146 insertions(+), 93 deletions(-) delete mode 100644 src/core/framebuffer.c delete mode 100644 src/core/framebuffer.h create mode 100644 src/core/idt.c create mode 100644 src/core/idt.h create mode 100644 src/core/int.S (limited to 'src/core') diff --git a/src/core/framebuffer.c b/src/core/framebuffer.c deleted file mode 100644 index 110dc73..0000000 --- a/src/core/framebuffer.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "framebuffer.h" - -#define MAX_COL 80 -#define MAX_LINE 25 - -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 clear(){ - for(char i=0;i