From 5bd25a37374e87c4f142113d870a320192a4bdc6 Mon Sep 17 00:00:00 2001 From: nigel Date: Sun, 2 May 2021 13:38:18 -0400 Subject: [PATCH] Moved some Kernel Terminal stuff to a seperate header file(s) --- src/kernel.c | 81 +++++++++++++++++++++++++--------------------------- src/kernel.h | 24 ++++++++++++++++ src/kterm.h | 11 +++++++ 3 files changed, 74 insertions(+), 42 deletions(-) create mode 100644 src/kernel.h create mode 100644 src/kterm.h diff --git a/src/kernel.c b/src/kernel.c index c06aa3a..dbb9d26 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -1,16 +1,37 @@ -#include -#include -#include -#include "vga_colors.h" -#include "string.h" -static const size_t VGA_WIDTH = 80; -static const size_t VGA_HEIGHT = 25; +#include "kernel.h" +#include "kterm.h" -size_t kterm_row; -size_t kterm_column; -uint8_t kterm_color; -uint16_t* kterm_buffer; +/** + * simple delay function + **/ +void delay(int t){ + volatile int i,j; + for(i=0;i +#include +#include + +#include "string.h" + +#define KernelTag "[Kernel]: " +#define AS_KERNEL() ( kterm_setcolor(VGA_COLOR_LIGHT_BLUE),\ + kterm_write(KernelTag, strlen(KernelTag)), \ + kterm_resetcolor()) + +void kterm_init(); + +void kterm_resetcolor(); +void kterm_setcolor(uint8_t); + +void kterm_putat(char, uint8_t, size_t, size_t); +void kterm_put(char); +void kterm_write(const char*, size_t); +void kterm_writestring(const char*); +void kterm_scrollup(); + + + diff --git a/src/kterm.h b/src/kterm.h new file mode 100644 index 0000000..4bf53d6 --- /dev/null +++ b/src/kterm.h @@ -0,0 +1,11 @@ +#include +#include +#include "vga_colors.h" + +static const size_t VGA_WIDTH = 80; +static const size_t VGA_HEIGHT = 25; + +size_t kterm_row; +size_t kterm_column; +uint8_t kterm_color; +uint16_t* kterm_buffer;